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


Unique constraints


Unique constraints

Author
Message
edwisdahl
edwisdahl
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 91
Agreed. Put needs some correction before running because of strong tags... got it wrong, so I tried it on local server. It DOES need correction before running...
Adrian Aucoin Jr.
Adrian Aucoin Jr.
SSC-Enthusiastic
SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)SSC-Enthusiastic (127 reputation)

Group: General Forum Members
Points: 127 Visits: 134
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '<'.


Agree with others, i'm so used to taking things verbatim that i kinda wondered if it was a trick question, either way my "needs correction" answer was wrong Angry
Tom Garth
Tom Garth
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1013 Visits: 1499
I had the correct answer selected, then looked it over 1 last time and saw the tags. I changed my answer and promptly got it wrong. To be fair though, if I had thought about it for just another 10 seconds, I would have ignored the tags. They are not in the newsletter.Cool

Tom Garth
Vertical Solutions

"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers

Rob Goddard
Rob Goddard
Say Hey Kid
Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)Say Hey Kid (662 reputation)

Group: General Forum Members
Points: 662 Visits: 558
Not wanting to be antagonistic or anything, but given the question and answers (ie, what the question is trying to get across), and the fact that the STRONG tag is a well known HTML tag, it doesn't take much to figure it's a badly formatted question as opposed to intended.

I did actually get it 'right', but I suppose the simple fact is that the code will not run as is, and so anyone that answers "The code needs changing" should be awarded a point until the QotD is updated...

--------
I love deadlines. I like the whooshing sound they make as they fly by. -Douglas Adams
wim.buyens
wim.buyens
SSC Veteran
SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)

Group: General Forum Members
Points: 277 Visits: 188
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '<'.

So I think it's the last answer, query need some correction before compile!!!!!
sknox
sknox
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2028 Visits: 2706
The <strong> tags are clearly an issue with the CMS here; I've seen it in a few other code samples. I don't know if the preview works with them where the final renderer doesn't or if some people thinks they work and aren't previewing what they write, or if the code is being run through a context highlighter that isn't fully compatible with this CMS, or something else. So I knew that should be ignored.

But I still got it wrong. I said the table wouldn't be created. Why? Because I foolishly expect consistency. Most of my development is small-scale, so I usually use SSMS to design my tables and manage my indexes. When you try to create an index > 900bytes in SSMS, it says that indexes can't be over 900 bytes, and won't let you go any further.

So I accept getting this wrong, because I've learned (once again) that Microsoft's GUI tools are NOT consistent with the capabilities of their underlying engines. Maybe the lesson will stick this time...

---below here is a <strong> tag check; please ignore it---
EDIT: the <strong> tag certainly works in forum posts...
sql_monkey
sql_monkey
SSC Veteran
SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)

Group: General Forum Members
Points: 291 Visits: 236
In retrospect, I think it's obvious what the intent of the question was. The problem is that everyone who has EVER answered a question here knows that subtle technicalities like this are the usual gotchas.

There are NOT 2 correct answers! Those who got it right with the "warning message" only got the correct answer by ignoring the obvious correct answer in favor of overlooking what SQL would not overlook!

What a waste of a good question about constraints.
wim.buyens
wim.buyens
SSC Veteran
SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)SSC Veteran (277 reputation)

Group: General Forum Members
Points: 277 Visits: 188
without the < strong> it is rather obvious that the table would still be created but a warning will be given.
As long as you insert/update so combined they are smaller then 900bytes.
I choose the because of < strong> , thought i was to think about names of tables! .. so that you had the include [ ]

Create table [< strong>sales2]
(
COL1 varchar(20) not null,
COL2 varchar(600) not null,
COL3 varchar(400) not null,
date datetime not null,
Unique clustered (COL2, COL3)
)
Same as getting a error when using create table a e instead of create table [a e]

At least when giving a question make sure that the question is right!
Please remove question because a lot of people would have it right!
Enigma475
Enigma475
SSC Eights!
SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)

Group: General Forum Members
Points: 929 Visits: 200
The tags did throw me off and I answered that the code will need to be modified. Too bad the question had this error because it was making a good point about indexes.
Michael Poppers
Michael Poppers
Right there with Babe
Right there with Babe (761 reputation)Right there with Babe (761 reputation)Right there with Babe (761 reputation)Right there with Babe (761 reputation)Right there with Babe (761 reputation)Right there with Babe (761 reputation)Right there with Babe (761 reputation)Right there with Babe (761 reputation)

Group: General Forum Members
Points: 761 Visits: 416
I didn't see any tags in the question -- perhaps someone corrected it after y'all noted a problem?

In any case, don't forget to 'drop table sales' after executing the code in your scratch database and seeing the warning ;-).
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