Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. uerobertson

    Using a variable for a column name

    Have you looked at faq183-3132 ?
  2. uerobertson

    Concatenate string in INSERT. Don't know # of records.

    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
  3. uerobertson

    Concatenate string in INSERT. Don't know # of records.

    Thanks SamGarland. I will have a look. Ursula
  4. uerobertson

    Concatenate string in INSERT. Don't know # of records.

    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...
  5. uerobertson

    Concatenate string in INSERT. Don't know # of records.

    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...
  6. uerobertson

    How to convert 2 coded fields to 6 uncoded and insert data into table?

    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...
  7. uerobertson

    How to convert 2 coded fields to 6 uncoded and insert data into table?

    Thanks Sunil. I didn't know you could use a case statement inside a select. That's perfect. Ursula.
  8. uerobertson

    How to convert 2 coded fields to 6 uncoded and insert data into table?

    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...
  9. uerobertson

    How to convert 2 coded fields to 6 uncoded and insert data into table?

    Do you have an example of what you mean by 'dynamic SQL'? U.
  10. uerobertson

    How to convert 2 coded fields to 6 uncoded and insert data into table?

    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...
  11. uerobertson

    How to convert 2 coded fields to 6 uncoded and insert data into table?

    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 |...
  12. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    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...
  13. uerobertson

    How to add two text fields?

    Well phili5678, This was exactly what I needed another year later yet. Thanks, the select a + b as c from myTable works perfectly. Thanks, Ursula
  14. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    Thanks Bygs. That answered my questions. U.
  15. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    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...
  16. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    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
  17. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    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...
  18. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    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...
  19. uerobertson

    Cursor vs. temporary table. Declaring with local variables

    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...

Part and Inventory Search

Back
Top