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
 Transact-SQL (2008)
 Is it possible to return row with blank columns

Author  Topic 

amitranjan
Starting Member

45 Posts

Posted - 2011-03-14 : 06:33:59
hi,
I just want to know , if its possble to return empty row, in case if the query is returning no row. I need if there is no row in the output, then the output result will get changed to table with one row, having all columns blank.

amit Ranjan

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-03-14 : 07:45:05
I guess you could do somethign like this

IF NOT EXISTS(Select * from yourTable)
SELECT null,null,null,...

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-03-14 : 07:53:35
Alternatively:

SELECT Col1, Col2 FROM table WHERE ...
UNION ALL
SELECT NULL, NULL

But this will return the NULL row regardless of the other query so ti will have to be filtered out in the front end.

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page
   

- Advertisement -