Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Transactions 1 Expand / Collapse
Author
Message
Posted Tuesday, May 15, 2012 8:04 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 10:58 AM
Points: 5,333, Visits: 25,272
Comments posted to this topic are about the item Transactions 1

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1300727
Posted Tuesday, May 15, 2012 8:05 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, October 22, 2014 7:13 PM
Points: 1,293, Visits: 1,128
Nice Question. I was distracted by the factor of go will make it as one transaction.
Post #1300728
Posted Tuesday, May 15, 2012 10:50 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, October 16, 2014 2:12 PM
Points: 2,278, Visits: 3,798
Good question, testing the basics. :)

Mohammed Moinudheen
Post #1300765
Posted Wednesday, May 16, 2012 1:16 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 9:09 PM
Points: 20,739, Visits: 32,528
Good question. Now, off to bed I go as today comes early.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1300803
Posted Wednesday, May 16, 2012 1:32 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 11:42 AM
Points: 13,295, Visits: 11,086
Very nice question, thanks!



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

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1300812
Posted Wednesday, May 16, 2012 1:42 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 2:56 AM
Points: 2,842, Visits: 3,876
Hm, I am a little confused because of the missing comma before the CONSTRAINT declaration. That does not seem to be required based on a first test. But I checked my BOL to see verify the syntax, and this is what I found (excerpt):
  ( { <column_definition> | <computed_column_definition> 
| <column_set_definition> }
[ <table_constraint> ] [ ,...n ] )

I cannot derive any meaning from that. Can anyone interpret this notation?

Anyways, it looks like the web contains an updated version of the syntax which makes more sense:
( { <column_definition> | <computed_column_definition> 
| <column_set_definition> | [ <table_constraint> ] [ ,...n ] } )

http://msdn.microsoft.com/en-us/library/ms174979(v=sql.105).aspx

However this doesnt explain why it is possible to add the table constraint without a comma between the last column specification and the constraint itself.

Any ideas?


Best Regards,
Chris Büttner
Post #1300823
Posted Wednesday, May 16, 2012 1:44 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:18 PM
Points: 6,048, Visits: 8,330
Nice question. I knew about implicit transaction, but I had to do some digging because I couldn't remember if primary key violation errors are batch-aborting or not.

(One possible -slight!- improvement to the question would have been to explicitly mention that the three insert statements are executed as a single batch; the current wording can be interpreted as them being executed one by one).



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1300824
Posted Wednesday, May 16, 2012 1:47 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 5:46 AM
Points: 1,415, Visits: 804
Wow - 2 points for that?

I was expecting some sort of the catch - I thought this was the easiest QOTD ever.
Post #1300827
Posted Wednesday, May 16, 2012 1:50 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:18 PM
Points: 6,048, Visits: 8,330
Christian Buettner-167247 (5/16/2012)
Hm, I am a little confused because of the missing comma before the CONSTRAINT declaration. That does not seem to be required based on a first test. But I checked my BOL to see verify the syntax, and this is what I found (excerpt):
  ( { <column_definition> | <computed_column_definition> 
| <column_set_definition> }
[ <table_constraint> ] [ ,...n ] )

I cannot derive any meaning from that. Can anyone interpret this notation?

Anyways, it looks like the web contains an updated version of the syntax which makes more sense:
( { <column_definition> | <computed_column_definition> 
| <column_set_definition> | [ <table_constraint> ] [ ,...n ] } )

http://msdn.microsoft.com/en-us/library/ms174979(v=sql.105).aspx

However this doesnt explain why it is possible to add the table constraint without a comma between the last column specification and the constraint itself.

Any ideas?


Chris, as far as I know, a constraint that follows a column definition without seperating column is considered a column constraint. But a column constraint should not reference any column.
I have not tested if the code as posted would actually work or complain about the column reference in the column constraint. If it does work, I would classify it as a parser bug, since the description in BOL implies that the seperating column between columns and table constraints is mandatory.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1300828
Posted Wednesday, May 16, 2012 1:56 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 2:56 AM
Points: 2,842, Visits: 3,876
Hi Hugo,

I did test it, and the table constraint (not column constraint) gets created, even though there is no comma in between.
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) 
Apr 2 2010 15:48:46
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: ) (Hypervisor)


Best Regards,
Chris Büttner
Post #1300833
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse