Skip to content

Tag: sql-server

How to remove duplicates in CTE from VARIABLES and TEMPORARY TABLE

I was looking for this solution in internet and none of them worked properly. I decided to create variables, then accommodates it in the user defined function: It works properly, because for example I am able to return the top 10 Customer in the Furniture Category in 2011 and 2012 Then, I would like to have a…

How to get list of custom user types for listed stored procedures?

I was able to find way to find custom user types for one stored procedure: How should I use this function for comma separated list of stored procedures? Answer If you have it available (SQL Server 2016 and newer), you can use STRING_SPLIT to split your list and then use CROSS APPLY to call the function for ea…

sql query to exclude not null columns

I have below table and records Now i do not want to display the rows having null values in the columns except primary key column. I used below query to arrive the above result. But my orginal table having 72 columns how can i check all the columns for getting above result. / Answer You could check the length …