I have a table User_Table in SQL Server 2008, there is a column UserAvatar (varbinary) that it can be null.
I need a query that returns the user avatar if it’s not null and if it is null return the default user avatar that is saved in a specific row (there is a column named ID that is PK)
What should I do?
You can do the logic in SP and call the SP from Code and get the data.
Other Option is you can do same Logic on your code
Select UserAvatar from User_Table where ID=XX
by using http://msdn.microsoft.com/en-us/library/tckcces5%28v=vs.80%29.aspx
IsDBNULL