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 2005 Forums
 Transact-SQL (2005)
 Create the first for as NULL

Author  Topic 

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-27 : 23:43:24
Is it possible to have the first row as empty?
I was thinking that if this is not possible then maybe i could create a table with a null column on the first row and do a left join?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-27 : 23:53:19
[code]
select col1 = NULL, col2 = NULL, . . .

union all

select col1, col2 . .. from sometable
[/code]


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

Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-28 : 00:01:21
Sorry i don't understand.
Do i need to create another table with a null value on a column?
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-28 : 00:06:56
No,no.Ok i got it.Thanks!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-28 : 06:23:05
Why do you need a dummy NULL row?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-28 : 12:09:36
Like...

Null
0
1
2

Khtan's example works fine for this.
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-28 : 18:33:44
Oh.You said why i need one.Well i want to have an empty row at a listbox in asp.net so the user can have the "none" option.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-29 : 04:25:26
quote:
Originally posted by sapator

Oh.You said why i need one.Well i want to have an empty row at a listbox in asp.net so the user can have the "none" option.



You dont need to do this in sql. When you populate data in the list box have first entry as "None"

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-29 : 20:29:49
With "None" i don't actually mean some sort of a string, just an empty row.I don't think i can manually create a p.e. "none" row in a databound listbox anyway.
Go to Top of Page

ann
Posting Yak Master

220 Posts

Posted - 2010-07-29 : 20:57:19
just add "" and it will be a blank value in your list box
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2010-07-29 : 23:19:58
Hey.
I think i did not explain very well.
The listbox is data binded in an sqldatasource so i cannot add manually anything.
Go to Top of Page
   

- Advertisement -