July 30, 2014 at 8:44 pm
Comments posted to this topic are about the item T- SQL Constraints
Thanks,
Shiva N
Database Consultant
July 30, 2014 at 8:45 pm
Good Question.
I do think the answer is a dead give away if you have familiarity with sys.objects though.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 31, 2014 at 12:32 am
SQLRNNR (7/30/2014)
Good Question.I do think the answer is a dead give away if you have familiarity with sys.objects though.
+1. Dead easy once you know which column you need.
Still nice question.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 31, 2014 at 1:00 am
type_desc is Latin1_General_CI_AS_KS_WS
So, also, in a "case sensitive" database type_desc LIKE '%cons%' returns data.
July 31, 2014 at 2:04 am
This was removed by the editor as SPAM
July 31, 2014 at 2:47 am
Stewart "Arturius" Campbell (7/31/2014)
SQLRNNR (7/30/2014)
Good Question.I do think the answer is a dead give away if you have familiarity with sys.objects though.
+1
Nice one, thanks Shiva
+1
Thanks
July 31, 2014 at 3:35 am
Koen Verbeeck (7/31/2014)
SQLRNNR (7/30/2014)
Good Question.I do think the answer is a dead give away if you have familiarity with sys.objects though.
+1. Dead easy once you know which column you need.
Still nice question.
+1. It would have been a bit less obvious if more of the incorrect options had used type_desc, with only one option using it that was the only column of sys.objects anone had to know to pick the right answer.
Tom
July 31, 2014 at 5:28 am
Koen Verbeeck (7/31/2014)
SQLRNNR (7/30/2014)
Good Question.I do think the answer is a dead give away if you have familiarity with sys.objects though.
+1. Dead easy once you know which column you need.
Still nice question.
Agreed, but a good question that may spark learning if you don't know system tables. I think sys.objects is probably the best place to start.
July 31, 2014 at 6:00 am
Good question.
+1.
---------------
Mel.
July 31, 2014 at 8:22 am
Thomas Abraham (7/31/2014)
Why would I use the method in the question when, as the answer showed, I can use:
SELECT *
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
I generally use sys.objects for this kind of lookup. I seldom think of the information_schema tables. It's just quick and easy to hit sys.objects and I forget often about the info...schema ones.
But it is also good to know a few different methods of retrieving the same information.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 31, 2014 at 8:30 am
Great question - thanks. I probably would have gotten it wrong had I not seen "type_desc" so many times before.
- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
July 31, 2014 at 10:56 am
Good question on sysobjects table. You could also have added a distinct to the select statement, so I would only get any table having multiple constraints only once.
July 31, 2014 at 12:34 pm
William Vach (7/31/2014)
Good question on sysobjects table. You could also have added a distinct to the select statement, so I would only get any table having multiple constraints only once.
+1
(but you know that... these sql statements are customizable)
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
July 31, 2014 at 11:49 pm
Nice question. Thanks for sharing
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy