facing some problem in inserting data

  • Hi Team,

    I facing some problem at the time inserting the data,

    for example:

    I insert the one sp into one column of the table its through some exception. please help me

    eg:
    insert into tblSp(Script,Display,Remarks)
    values('Create procedure [dbo].[Delete]
    @Id int = null
    as
    begin
        update master
             set Status=0,
               DeleteDate=getdate(),
                 Reason = 'Test '

    end
    ','Delete','new')

    --> it's through exception on  'Test '

    please tell me how to insert the data

  • you need to escape the single quotes for that field - so 'test' becomes ''test''

  • rabbanishaik.net - Monday, May 28, 2018 5:26 AM

    Hi Team,

    I facing some problem at the time inserting the data,

    for example:

    I insert the one sp into one column of the table its through some exception. please help me

    eg:
    insert into tblSp(Script,Display,Remarks)
    values('Create procedure [dbo].[Delete]
    @Id int = null
    as
    begin
        update master
             set Status=0,
               DeleteDate=getdate(),
                 Reason = 'Test '

    end
    ','Delete','new')

    --> it's through exception on  'Test '

    please tell me how to insert the data

    Out of interest, can you explain what this table will be used for? Also, what is the @Id variable for?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply