|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 11:47 AM
Points: 151,
Visits: 277
|
|
| Comments posted to this topic are about the item T-SQL
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 11:21 AM
Points: 2,163,
Visits: 2,148
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 3:20 AM
Points: 46,
Visits: 34
|
|
No. My answer is first time BEGH, second time BEGH and Third time BEGH. Bcoz these two variables are varchar only. so if u pass the interger value without single quote it will accept.
First time :
insert into #test values ('1','A'), ('','B') insert into #test values (2,'D'), ('','E') insert into #test values ('','G'), ('','H') go -- First select statement select * from #test where c1 = ' ' delete #test answer : B E G H
Second time: insert into #test values ('1','A'), ('','B') insert into #test values ('2','D'), ('','E') insert into #test values ('','G'), ('','H') go -- Second select statement select * from #test where c1 = ' ' delete #test
Third Time:
insert into #test values (1,'A'), ('','B') insert into #test values (2,'D'), ('','E') insert into #test values ('','G'), ('','H') go -- Third select statement select * from #test where c1 = ' '
answer : B E G H
Note: So all three times the value comes same value only in SQLSERVER 2005
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 11:47 AM
Points: 151,
Visits: 277
|
|
The question is " What is the output of the select statement from the below code executed in sql server 10.0.1600 and with default settings " and not in SQL Server 2005 
And are you sure this below code executed successfully in 2005 ? insert into #test values ('1','A'), ('','B')
Thanks
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 19, 2011 1:59 AM
Points: 1,042,
Visits: 234
|
|
Gopinath Srirangan (3/22/2011)
The question is " What is the output of the select statement from the below code executed in sql server 10.0.1600 and with default settings " and not in SQL Server 2005  And are you sure this below code executed successfully in 2005 ? insert into #test values ('1','A'), ('','B') Thanks
The Insert statement would definitely not work in 2005. The feature of inserting multiple rows using VALUE caluse is introduced in 2008.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 19, 2011 1:59 AM
Points: 1,042,
Visits: 234
|
|
Interesting question.
Good learning for me.
Thanks.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 19, 2011 1:59 AM
Points: 1,042,
Visits: 234
|
|
tejaswini.patil (3/22/2011)
Gopinath Srirangan (3/22/2011)
The question is " What is the output of the select statement from the below code executed in sql server 10.0.1600 and with default settings " and not in SQL Server 2005  And are you sure this below code executed successfully in 2005 ? insert into #test values ('1','A'), ('','B') Thanks The Insert statement would definitely not work in 2005. The feature of inserting multiple rows using VALUE caluse is introduced in 2008.
If the INSERT statement syntax is changed according to SQL Server 2005 and executed the script in SQL Server 2005 then the output is B, E, G, H for all the three select statements.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 4:24 AM
Points: 1,161,
Visits: 642
|
|
| Too much thinking for one point...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, April 19, 2011 1:59 AM
Points: 1,042,
Visits: 234
|
|
paul s-306273 (3/22/2011) Too much thinking for one point...
"Point" does not matter however question matters.
I have found the question interesting and am sure there will be good learning for me.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 9:59 PM
Points: 1,354,
Visits: 1,299
|
|
Gopinath Srirangan (3/22/2011)
And are you sure this below code executed successfully in 2005 ? insert into #test values ('1','A'), ('','B') Thanks It will not work in 2005. That's the server I use daily and I wish this syntax would work because it could simplify my job significantly when inserting a bunch of values manually.
|
|
|
|