|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Today @ 7:53 AM
Points: 1,868,
Visits: 1,044
|
|
greated question
Malleswarareddy I.T.Analyst MCITP(70-451)
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 6:52 AM
Points: 1,111,
Visits: 1,233
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, March 25, 2013 8:37 AM
Points: 163,
Visits: 275
|
|
Note: insert into #test values (2,'D'),('','E') is equal to insert into #test select 2,'D' union select '','E' Actually, its like: insert into #test values (2,'D'),('','E') is equal to insert into #test select 2,'D' union all select '','E'
PeteK I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 12:10 PM
Points: 7,185,
Visits: 7,285
|
|
Really good question. Thanks.
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
http://es.linkedin.com/in/tomthomsonsoftware
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: 2 days ago @ 11:58 PM
Points: 57,
Visits: 109
|
|
| Excellent question. Good point emphasized when inserting with multiple value segments with single insert statement.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, March 28, 2013 7:38 AM
Points: 894,
Visits: 317
|
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Sunday, July 15, 2012 11:51 PM
Points: 65,
Visits: 103
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Sunday, July 15, 2012 11:15 AM
Points: 35,
Visits: 71
|
|
Nice question. got a good knowledge. thanks
Thanks.
Reji PR, Bangalore

|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 12:36 AM
Points: 2,547,
Visits: 3,648
|
|
pksutha (3/23/2011) Hi Gopi,
select * into TestTable from ( select CAST(1 as smallint) as C1, CAST(6 as smallint) as C2 union select CAST(2 as tinyint),CAST(6 as int) union select CAST(3 as bigint),CAST(6 as smallint) union select CAST(4 as int),CAST(6 as tinyint) ) T
Note: Practically i want to see the difference... will u give example for that..
Hi pksutha,
try this query to see the resulting data type:
SELECT RowID ,Col ,SQL_VARIANT_PROPERTY(Col,'BaseType') BaseType ,SQL_VARIANT_PROPERTY(Col,'Precision') Precision ,SQL_VARIANT_PROPERTY(Col,'Scale') Scale ,SQL_VARIANT_PROPERTY(Col,'TotalBytes') TotalBytes ,SQL_VARIANT_PROPERTY(Col,'Collation') Collation ,SQL_VARIANT_PROPERTY(Col,'MaxLength') MaxLength FROM ( SELECT 1 AS RowID, CAST(1 AS int) Col UNION ALL SELECT 2 AS RowID, CAST('2' AS char) Col )SubQ And play a little with the datatypes & order of data types in the CASTs to see what the resulting data type will be.
Best Regards,
Chris Büttner
|
|
|
|