SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Unique constraints


Unique constraints

Author
Message
edwisdahl
edwisdahl
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 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 (179 reputation)SSC-Enthusiastic (179 reputation)SSC-Enthusiastic (179 reputation)SSC-Enthusiastic (179 reputation)SSC-Enthusiastic (179 reputation)SSC-Enthusiastic (179 reputation)SSC-Enthusiastic (179 reputation)SSC-Enthusiastic (179 reputation)

Group: General Forum Members
Points: 179 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
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1995 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
SSC Eights!
SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)SSC Eights! (984 reputation)

Group: General Forum Members
Points: 984 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-Addicted
SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)

Group: General Forum Members
Points: 461 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
SSCarpal Tunnel
SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)SSCarpal Tunnel (4K reputation)

Group: General Forum Members
Points: 4030 Visits: 2928
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
Old Hand
Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)Old Hand (397 reputation)

Group: General Forum Members
Points: 397 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-Addicted
SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)SSC-Addicted (461 reputation)

Group: General Forum Members
Points: 461 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! (967 reputation)SSC Eights! (967 reputation)SSC Eights! (967 reputation)SSC Eights! (967 reputation)SSC Eights! (967 reputation)SSC Eights! (967 reputation)SSC Eights! (967 reputation)SSC Eights! (967 reputation)

Group: General Forum Members
Points: 967 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
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1125 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