September 20, 2013 at 12:49 am
Easy one. Thanks.
September 20, 2013 at 1:28 am
Good one, thank you for the post.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
September 20, 2013 at 1:34 am
This was removed by the editor as SPAM
September 20, 2013 at 1:50 am
I would have had slightly more troubles, if the INT data type would've been inserted first.
Because in the first try I thought that the numeric data type would set the returned data type which is definitely wrong.
Thank you for the question!
________________________________________________________
If you set out to do something, something else must be done first.
September 20, 2013 at 2:34 am
Dscheypie (9/20/2013)
I would have had slightly more troubles, if the INT data type would've been inserted first.Because in the first try I thought that the numeric data type would set the returned data type which is definitely wrong.
Thank you for the question!
Statement, when int is first
SELECT COALESCE(Col2, Col1) AS 'FirstNotNull' FROM dbo.T_TEST
will have the same output(I mean type:), not numbers), because returned data type is defined expression with the highest data type precedence.
September 20, 2013 at 2:38 am
As well as the reference given, this one should be included too:
http://msdn.microsoft.com/en-us/library/ms190309(v=sql.105).aspx
September 20, 2013 at 3:13 am
very easy one 🙂
September 20, 2013 at 3:15 am
Andrew Watson-478275 (9/20/2013)
As well as the reference given, this one should be included too:http://msdn.microsoft.com/en-us/library/ms190309(v=sql.105).aspx
Thanks for referring this link Andrew. I had planned to include this link as additional info but somehow managed to miss it. 🙂
September 20, 2013 at 3:38 am
Very nice question for a Friday, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
September 20, 2013 at 6:25 am
nice weekend question 🙂
September 20, 2013 at 6:28 am
Good one, thanks!
September 20, 2013 at 6:59 am
Pavel Bakunovich (9/20/2013)
Dscheypie (9/20/2013)
I would have had slightly more troubles, if the INT data type would've been inserted first.Because in the first try I thought that the numeric data type would set the returned data type which is definitely wrong.
Thank you for the question!
Statement, when int is first
SELECT COALESCE(Col2, Col1) AS 'FirstNotNull' FROM dbo.T_TEST
will have the same output(I mean type:), not numbers), because returned data type is defined expression with the highest data type precedence.
Oh, this is even easier. Good idea, Pavel! Simple, yes!
________________________________________________________
If you set out to do something, something else must be done first.
September 20, 2013 at 7:01 am
Nice question,Normally asked in interviews
Pramod
SQL Server DBA | MCSE SQL Server 2012/2014
in.linkedin.com/in/pramodsingla/
http://pramodsingla.wordpress.com/
September 20, 2013 at 7:29 am
Easy one to end the week on. 😀 Thanks for the question!
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply