Skip to content

Tag: sql-server

Execute query using C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 years ago. Improve this question I am trying to execute some SQL code, connected directly to my database, but I don’t k…

How to replace empty spaces with NULL

I have a column in sql server 2012 which contain white spaces. I want to replace these empty spaces with NULL. I have written the following query but its not working. How to achieve the above functionality. Thanks in advance. Answer Use nullif

Finding max value of multiple columns in Sql

How can I find maximum value on multiple columns. This is what I have so far. This code is giving me the error: Incorrect syntax near ‘maxval’. Answer Are you simply looking for GREATEST? However GREATEST Returns NULL when a value is NULL, so you might want to care about this, too. For instance: E…

Printing integer variable and string on same line in SQL

Ok so I have searched for an answer to this on Technet, to no avail. I just want to print an integer variable concatenated with two String variables. This is my code, that doesn’t run: It seems like such a basic feature, I couldn’t imagine that it is not possible in T-SQL. But if it isn’t po…