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
 Add default Number

Author  Topic 

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-09-12 : 22:23:36
Guys,

I have a select statement. I just need to add default 1 as qty from my select statement. I dont know how to do this.

Like..

Select esn, date, 1 as Qty from TABLE1

Thank you in Advance.

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-09-12 : 22:43:57
I tried this one. so far i think this is good enough.

Case when Substring(vp.ItemNumber,1,2) ='P3' Then '1'
Else ' ' End As Quantity
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-09-12 : 23:49:14
please post some sample data and expected result


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-13 : 00:40:51
why you're returning it as varchar? its numeric data so you can return it as int itself?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2011-09-13 : 01:02:46
Ah okay. Thank you for clarification.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-13 : 01:20:32
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -