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.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Constant value in a query

Author  Topic 

Vadz
Starting Member

11 Posts

Posted - 2012-11-14 : 18:14:50
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
Go to Top of Page

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 this

company Capacity type
300 400 Toyota
300 400 Toyota
300 400 Hyundai
300 400 Hyundai
300 400 Nissan

so i want to be display like this in a unique value the the 1 below

company Capacity type
400 Toyota
400 Toyota
300 Hyundai
300 Hyundai
300 Nissan

400 should assigned only to Toyota and 300 only too Hyundai and Nissan

thanks for your patient in reading ..
Go to Top of Page

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 MVP
http://visakhm.blogspot.com/

Go to Top of Page

Vadz
Starting Member

11 Posts

Posted - 2012-11-15 : 15:40:48
there are only 3 types...
Go to Top of Page

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 MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -