Archive for

Best practice to check for DBNull using .Net:

When we retrieve data from database it is very important for to check for NULL values if writing a robust application. Here are following ways on how to accomplish this need: 1) Using System.Convert: There is a direct method available to Check for DBNull. Here is what you have to do: // Assuming that a … Continue reading

IsNullOrEmpty – A user Defined Function in SQL server

This is an equal implementation of C# function String.IsNullOrEmpty in SQL. This function returns 1 if parameter is NULL or empty. Here is the implementation of this function: Implementation: CREATE FUNCTION dbo.IsNULLOrEmpty(@data varchar(max)) RETURNS BIT AS BEGIN if(NULLIF(@data,”)) is NULL return 1 — return 1 when there is a NULL or Empty. return 0 — … Continue reading

Find stored procedure in all databases

Are you looking for a way to find procedure in all databases? In this post you will find a way to search procedure in all databases. There are some other ways to do so but here it will be demonstrated by using dynamic SQL. The attached procedure will prepare a query with respect to all … Continue reading