Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
how to declare a constant value in a query?select a(h.test_id) as Cat,i.Id as dogid,i.Capacity as total,i.office as Company,group by i.id.i want to maki.Capacity as total(300) and i.office as Company(400)as my different constant value..thanks in advance
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts
Posted - 2012-11-14 : 19:46:08
The syntax of what you have posted does not seem to be correct. Is "a(h.test_id)" invoking a UDF named "a"? If so it needs to be prefixed with the schema name. In any case, is something like this what you are looking for?
select h.test_id as Cat, i.Id as dogid, i.Capacity as total, i.office as Company, 300 as Capacity, 400 as Company
Vadz
Starting Member
11 Posts
Posted - 2012-11-14 : 20:51:37
thanks for your reply.Query runs fine now now so my output look like thiscompanyCapacitytype 300 400 Toyota 300 400 Toyota 300 400 Hyundai 300 400 Hyundai 300 400 Nissanso i want to be display like this in a unique value the the 1 belowcompanyCapacitytype 400 Toyota 400 Toyota 300 Hyundai 300 Hyundai 300 Nissan400 should assigned only to Toyota and 300 only too Hyundai and Nissanthanks for your patient in reading ..
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2012-11-15 : 10:42:47
so what about other types? are there only these 3 always?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Vadz
Starting Member
11 Posts
Posted - 2012-11-15 : 15:40:48
there are only 3 types...
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2012-11-15 : 23:55:54
quote:Originally posted by Vadz there are only 3 types...
I dont understand your output. you have three columns but i can see only 2 set of values. post outpt within code tags to show us correct alignment------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/