SamGarland,
The page wasn't exactly what I needed but I did find the following article on the SQLTeam site that answered my question. Thanks for the link.
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=9978
Ursula
Thanks but I would rather avoid cursors. I'm actually rewriting code that used cursors (and other expensive code). I'm nearly done (this procedure and one other to complete) and the processing time has gone down from over 4 hours to under 3 minutes.
I know I can do part of the INSERT and then...
I need to do an INSERT where I SELECT, concatenate and INSERT all in one statement.
I've researched thread183-90896, and FAQ183-1067 but neither are exactly what I need. Would someone please be able to help me with the syntax?
This code works for one record at a time but uses too many...
Hi,
Got it to work. In case anyone is interested, here is the code:
DROP TABLE #dateTable
SELECT [IIC Model Number],
CASE [Code of Date] WHEN 'POD' THEN [Date] END oDate1,
CASE [Code of Date] WHEN 'PD2' THEN [Date] END sDate1,
CASE [Code of Date] WHEN 'MOD' THEN [Date] END oDate2,
CASE...
Thanks for the code snippet. I will experiment and let you know. The lightbulb has finally gone on.
BTW: We seem to be miscommunicating about the dates. There are only 6 dates. There are three oDates (order dates) and 3 sDates (shipping dates). But I think I have to write the code now.
Thanks...
There are 6 types of dates only but no maximum number of records and ~78,000 different ID's (~468,000 records in Table 1).
The dates themselves are completely random. (I knew I should have put in different sample data. I did it that way to try to make it obvious where the dates go in the new...
Hi,
I am writing a stored procedure to convert our client's data and move it into our database. I am using SQLSvr 2000 and Win2000.
I have a table containing 3 fields:
Table1
ID | Date | Code
-----------------
1 | Jan 1 | OD1
-----------------
1 | Feb 1 | SD1
-----------------
1 | Mar 1 |...
Hi Guys,
I'm back. The addUpdate procedure above got put on the back burner for a few days but now I have begun to work on it again.
I have a problem. When I changed the procedure to a function it gave the error:
Only functions and extended stored procedures can be executed from within a...
Hi Bygbobbo,
Yes, I am definitely looking for a way to do the updating without cursors. I think I understand now so let me see if I've got this right.
If I make the addUpdate a function and use it in a SELECT statement, the function will be run on every record generated by the SELECT.
I...
Hi royjimenez,
Thanks for the cursor with variables stuff. It works great. From what I've read though cursors are evil so I'm still looking for an alternative.
Thanks very much,
Ursula
Hi Bygbobbo,
I'm sorry but I don't understand your post. Why should I convert the stored procedure to a function? I don't understand how that would solve my problem with the cursor. I would still have to retrieve each record before calling the function. Everything in the updateRNFDesc sp works...
Ok, here's my code. The CURSOR is currently hardcoded for the table name and field names. I would like to be able to pass them into the updateRNFdesc sp instead.
The Results table is created by the Import Data... Wizard from an Access table. This is why I would like to pass the table and field...
I am writing a stored procedure that will take in a table name and some field names and use the info from that table to update or add records to another table. I can't just use the UPDATE INTO because an ID is retrieved from yet another table. (Not my table design - came down from higher up). My...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.