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
 General SQL Server Forums
 New to SQL Server Programming
 Select Cast

Author  Topic 

Nural
Starting Member

1 Post

Posted - 2009-01-06 : 16:01:27
Hi all,
I have a statement like below but couldn't understand what 'B' means in that statement.

I'd really appreciate if you can help me understand it.

Thanks,

SELECT cast(a.contact_id as numeric(13,0)) contact_id,
b.assoc_membership,
........
FROM
(SELECT contact_id, min(buy_inq_prosp_ind)
FROM (SELECT contact_id,
'B' buy_inq_prosp_ind
FROM wrk_dm_sales_all

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-01-06 : 16:14:55
That means 'B' is a constant returned value in the select list and is has the column-name buy_inq_prosp_ind.

So it is more clear:
FROM 
(SELECT contact_id, min(buy_inq_prosp_ind)
FROM
(SELECT contact_id, 'B' AS buy_inq_prosp_ind
FROM wrk_dm_sales_all ...


Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-01-07 : 02:19:57
b is default value display for every record and it is alias name for that column buy_inq_prosp_ind
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-01-07 : 02:25:29
For the Above Statement,
By Default,The Value B is getting for every reocrd in the result Set in column name buy_inq_prosp_ind.
Go to Top of Page
   

- Advertisement -