How to do a SQL NOT NULL with a DateTime?

This might be simple, but I cant figure out how to do a simple DateTime with a NOT NULL? I want to do something like this: SELECT * FROM someTable WHERE thisDateTime IS NOT NULL But that obviously doesn’t work. I am using MS SQL 2005 if that matters. Thank you.

How to profile for one table in SQL Server?

How can I add a filter which can trace sql statements for a particular table name?

SQL Server not working after upgrading windows8.1 to windows 10

TITLE: Connect to Server —————————— Cannot connect to Thejus-PC. —————————— ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or > was not accessible. Verify that the instance name is correct and that > SQL Server is configured to allow remote connections. (provider: Named […]

Could not write value to key \SOFTWARE is displayed for SSMS Install in a Windows 7 machine with an Administrator account

I have the following error when installing SQL Server 2014: Could not write value to key \SOFTWARE. Verify that you have sufficient access to that key, or contact your support personnel. It happens when it tries to install the SSMS and my machine has Windows 7 running. I have done the following things in order […]

Managing SQL Server Connections

What is the the best practice for SQL connections? Currently I am using the following: using (SqlConnection sqlConn = new SqlConnection(CONNECTIONSTRING)) { sqlConn.Open(); // DB CODE GOES HERE } I have read that this is a very effective way of doing SQL connections. By default the SQL pooling is active, so how I understand it […]

SQL script to “copy” a database

I want to write a SQL script that will copy a database on the same server. I could do a backup/restore, but I think it might be faster to just “copy” somehow. Does anyone know if this is possible? Is there a way to write a script that will just detach, copy the file on […]

Split a value in one column to two columns

I have a column in SQL that I would like to split a column into two columns on select (by a delimiter). For example, the table currently has: ——— Mary – 16 I’d like two columns as the result of the query: ——– ——– Mary 16 Thanks for your help.

How to call C# function in stored procedure

SQL Server 2005 supports CLR so it means we can use CLR in backend so how to do that, I have some function in c# which do some complex manipulation with date-time variable now I want to use those functions in SP. First of all IS IT POSSIBLE TO DO THIS.

SQL Server 2012 Random string from a list

say I have 3 values, Bill, Steve, Jack. and I want to randomly update a table with those values, eg Update contacts set firstname = (‘Bill’,’Steve’,’Jack’) where city = ‘NY’ how do I randomize these values? Thanks

How do I check if a directory exists using SQL Server?

I know this command will create a directory: EXEC master.sys.xp_create_subdir ‘C:\testing\’ But how do I check whether ‘C:\testing\’ exists? IF EXISTS(…

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.