Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello guysi have a query, which i want to retrieve certain columns, but if a certain column isnull, it should be replaced by another value.However, I am querying more than one value.what is wrong here
Select groupID, username, isnull(GroupName,'General Categories') as GroupName, convert(varchar(30), CreateDate ,100) CreateDate, totalnumbers from Groups where username = 'username'
bklr
Master Smack Fu Yak Hacker
1693 Posts
Posted - 2009-01-03 : 06:03:40
i think that query will work fine when ever groupname is null u will get the general categories in that columnsu can use coalesce also
Also you should strongly consider not converting date into varchar if its for display purpose. formatting should be done at yourfront end as far as possible.