Sunday, February 19, 2012

Help me Insert/Update!

Can someone please Help,

I'm trying to write an insert/update query but it doesn't work.
My syntax is similar to the following

INSERT/UPDATE INTO GL_SCORE VALUES (1, 'andrew');
INSERT INTO GL_SCORE VALUES (2, 'gordon');
SELECT * FROM GL_SCORE

But it doesn't work, why?

Please help me insert/update becuase it would be good.RTFM

Look up the syntax for UPDATE & INSERT, I'm sure you can answer your question by yourself.|||Hi,

I found syntax on insert and update but nothing on insert/update, like doing them both at once. Why?|||Why do you think, that SQL Server has a Update/Insert command, like Oracle 9i has it's MERGE? Which SQL Server version you are talking about?|||Dear Tronboy

I have never encountered Insert/Update in SQL Server syntax
I think you will have to choose, either its INSERT or UPDATE

If its a type of functionality or logic which is often used you should consider putting it in a user defined function or sproc.|||Tronboy,

Insert and Update are two different command in SQL Server (although updates actually involve deleting and reinserting rows, this all happens behind the scenes).

You may be getting confused because triggers can be set to execute and update.

blindman|||Originally posted by blindman
You may be getting confused because triggers can be set to execute and update.
blindman

Good point, blindman; this is the way to confuse TronBoy completely. I'm proud of you!

No comments:

Post a Comment