locked
Unable to insert the values for request_id field RRS feed

  • Question

  • Hi, i have defined one table it contains request_id field having data type as varchar(50) and the values for request_id field is Q01340852,Q01340853 etc.........
    • Changed type SubbuAnnamaneni Friday, November 9, 2012 11:51 AM not yet get any reply from anybody
    • Changed type Kalman Toth Thursday, January 31, 2013 2:56 PM Question.
    Friday, November 9, 2012 11:45 AM

Answers

  • Try it this way.

    INSERT INTO [Eli Lilly].[dbo].[TEMP] ([REQUEST_ID])    VALUES     ('Q01340852')

    INSERT INTO [Eli Lilly].[dbo].[TEMP] ([REQUEST_ID])    VALUES     ('Q01340853')

    Friday, November 9, 2012 11:51 AM
  • Be careful, with this update you are going to set this value into ALL Rows of the table!!!
    Friday, November 9, 2012 2:04 PM

All replies

  • Hi, i have defined one table it contains request_id field having data type as varchar(50) and the values for request_id field is Q01340852,Q01340853 etc.........

    and I was unable to insert the above values into table

    the insert statement is like below

    INSERT INTO [Eli Lilly].[dbo].[TEMP]
               ([REQUEST_ID])
         VALUES
               (<Q01340852, varchar(50),>) and the error i got is 

    Msg 102, Level 15, State 1, Line 4
    Incorrect syntax near '<'.

    can you please help me?

    Friday, November 9, 2012 11:47 AM
  • Try it this way.

    INSERT INTO [Eli Lilly].[dbo].[TEMP] ([REQUEST_ID])    VALUES     ('Q01340852')

    INSERT INTO [Eli Lilly].[dbo].[TEMP] ([REQUEST_ID])    VALUES     ('Q01340853')

    Friday, November 9, 2012 11:51 AM
  • Thank You very much Markus, am able to insert now.
    Friday, November 9, 2012 12:05 PM
  • Markus, i want to update the value for request_id from Q01340852 to Q01340854 for example, how do i update the value?
    Friday, November 9, 2012 12:36 PM
  • Got it Markus, Thanks.

    UPDATE [Eli Lilly].[dbo].[TEMP] SET [Eli Lilly].[dbo].[TEMP].[REQUEST_ID]='Q01340854'

    Friday, November 9, 2012 1:02 PM
  • Be careful, with this update you are going to set this value into ALL Rows of the table!!!
    Friday, November 9, 2012 2:04 PM