|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Saturday, April 06, 2013 12:20 AM
Points: 649,
Visits: 263
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 12:10 PM
Points: 7,185,
Visits: 7,285
|
|
Now wouldn't it be fun if a unification capability were added to SQL so that you in an insert statement could specify the values of some computed columns and leave out the values of some of the non-computed columns and have the database engine compute the set of (new) rows that would satisfy the computations and any constraings (keys, check constraings, etc) and insert them all. 
Or maybe not - probably safer to stick to doing that sort of thing in prolog or parlog or something.
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
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 6:30 AM
Points: 9,410,
Visits: 6,495
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 9:12 AM
Points: 1,167,
Visits: 646
|
|
Interesting question.
Keep them coming...
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 8:36 AM
Points: 2,681,
Visits: 2,423
|
|
| I was looking for the trick, but couldn't find one. Nice question. Thanks.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 7:16 AM
Points: 2,030,
Visits: 2,869
|
|
Nice easy one for a Monday morning. Thanks.
I was working with computed columns last week and ran across this issue.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, March 15, 2013 2:43 PM
Points: 3,924,
Visits: 1,554
|
|
Create Table #Test (a int, b int, C as a+b ) go insert into #test values (3,4) insert into #test values (1,7) go select * from #test order by 1 go drop table #test go
Isn't it funny that when you say order by 1, sql server assumes 1 as column and gives result order by column 1 but at the same time when you execute
select 1 from #test
you get result as 1
SQL DBA.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:01 AM
Points: 1,232,
Visits: 1,046
|
|
Nice question for a monday.
I Also give this question Five stars for have correct code and no typos in the question or the answer.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 6:30 AM
Points: 9,410,
Visits: 6,495
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 9:45 AM
Points: 2,163,
Visits: 2,151
|
|
Nice question, I would have gotten it wrong had the option for the problem with + not been there. (I didn't see the computed column so once I went looking for the + I immediately knew what was going to happen.
Thanks!
|
|
|
|