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?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

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

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