Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Inserted Identity


Inserted Identity

Author
Message
chrisfradenburg
chrisfradenburg
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1784 Visits: 2061
Comments posted to this topic are about the item Inserted Identity
Paul White
Paul White
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11486 Visits: 11354
A good question, though the example was more complex than it needed to be.



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Carlo Romagnano
Carlo Romagnano
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3860 Visits: 3276
INSERTED pulls from what is entered into table, not from the select list.

Of course!

I run on tuttopodismo
Kameswari Aravindh
Kameswari Aravindh
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2239 Visits: 177
Good Question. :-)
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
SSCertifiable
SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)SSCertifiable (6.5K reputation)

Group: General Forum Members
Points: 6530 Visits: 7195
Good question, thanks.

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
TomThomson
TomThomson
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11515 Visits: 12092
Not a bad question. Just a bit too easy.

I can't imagine how anyone could select the answer 4,5,6 because even if they mistakenly look at the select list instead of the inserted data the only column named id in the select list is the id column from deleted, which contains the values 1,2,3. Maybe if the id column of define had been declared as "id id INT IDENTITY(4,1)" instead of "id id INT IDENTITY(1,1)" there would have been a better chance of people erroneously selecting the wrong answer 4,5,6. Only 3% of people have selected 4,5,6 so far, and I suspect that proportion will not increase as more people answer - perhaps it will decrease.

I suppose some might go for the "error" answer if they think that "define" is a reserved word that would need to be quoted when used as a table name, but I can't think of any T-SQL syntax that uses "define" in a way that would require it to be a reserved word so I don't know why anyone would think that. But 22% so have have thought that (or derampt up some other imaginary error).

If it weren't for the fact that 22% of answers so far are "error" I would be predicting a high 90s correct answer rate for this one.

Tom

steve.smith 42985
steve.smith 42985
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 216
Although the answer of what was intended is obviously 1,2,3 it does depend where you run this.

Try running it on the AdventureWorks DB of a fresh SQL 2005 Install and it will indeed error:

Msg 2714, Level 16, State 6, Line 5
There is already an object named 'define' in the database.
Msg 207, Level 16, State 1, Line 10
Invalid column name 'value'.
Kwex
Kwex
Old Hand
Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)

Group: General Forum Members
Points: 333 Visits: 240
Good question ... a bit too much text though considering that the final focus was on the IDENTITY column :-)
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19411 Visits: 13250
Easy question, thanks.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Thomas Abraham
Thomas Abraham
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2457 Visits: 2255
SQLkiwi (8/25/2011)
A good question, though the example was more complex than it needed to be.


Agreed. Although it did simulate a lot of maintenance programming I've had to do. Reminded me of situations where you'd wonder just what the heck is this guy trying to do here?

Please don't go. The drones need you. They look up to you.
Connect to me on LinkedIn
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search