Insert..Set form of insert statement..need help

  • I need to use the insert...set form in my code but the statement i have written is not working.

    insert into contactinfo

    set FullName='XYZ',

    Source='ABC',

    CreatedDate='2008-09-09 00:00:00.000',

    ModifiedDate='2008-09-09 00:00:00.000'

    Could anyone tell me if there is any syntactical error in the above statement?

    I m getting teh followign error:

    Incorrect syntax near the keyword 'set'.

  • Try this instead:

    insert into contactinfo (FullName, Source, CreatedDate, ModifiedDate)

    values ('XYZ', 'ABC', '2008-09-09 00:00:00.000', '2008-09-09 00:00:00.000')

  • thnkz.

    I know the above syntax but I got to know that there is an insert...set form also. Or is it that it is present only in MySQL and not in SQL Server 2005?

  • Pooja_prasad (10/29/2008)


    thnkz.

    I know the above syntax but I got to know that there is an insert...set form also. Or is it that it is present only in MySQL and not in SQL Server 2005?

    I don't know about MySQL but as far as the SQL language goes I've never seen an insert...set statement anywhere. And there certainly isn't one in SQL Server.

    There is an update...set statement though.

  • k..Thnkz:-)

  • Pooja_prasad (10/29/2008)


    thnkz.

    I know the above syntax but I got to know that there is an insert...set form also. Or is it that it is present only in MySQL and not in SQL Server 2005?

    SQL Server <> MySQL !!

    UPDATE uses SET, INSERT not. I'm afraid you have to cope with it...

    Ronald

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

Viewing 6 posts - 1 through 5 (of 5 total)

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