SQL Server - How to combine 2 date and time columns into 1 column.
August 9th, 2007
Sample columns
date_col:
2007-05-06 00:00:00.000
time_col:
1971-01-01 01:06:23.000
Use this…
DATEADD(hh ,DATEPART(hh, [time_col]]), DATEADD(n ,DATEPART(n, [time_col]) , DATEADD(ss ,DATEPART(ss, [time_col]) , [date_col])))
To get this…
2007-05-06 01:06:23.000
Post Comment Now
SQL Injection Cheat Sheet
June 27th, 2007
Restore MS SQL Database Via Query
May 15th, 2007
RESTORE DATABASE SharePoint_Jeff FROM DISK = 'D:\SharePoint_Content_db_200705072120___jeff_restore.BAK' WITH MOVE 'SharePoint_Content' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\SharePoint_Jeff_Data.MDF', MOVE 'SharePoint_Content_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\SharePoint_Jeff_Log.LDF', STATS = 1, REPLACE GO
Post Comment Now
SQL - Query Database Size
May 1st, 2007
DECLARE @dbsize DEC(15,0) DECLARE @freespace DEC(15,0) DECLARE @spaceused DEC(15,0) SELECT @dbsize = SUM(CONVERT(DEC(15),SIZE)) FROM sems_teas5.dbo.sysfiles SELECT database_name = 'YOUR_DB_NAME', database_size = (@dbsize / 128), spaceused=(SELECT (SUM(CONVERT(DEC(15),reserved))/128) FROM sems_teas5..sysindexes WHERE indid in (0, 1, 255))
Post Comment Now
.NET ConnectionString Encyption
April 25th, 2007
The following command will encrypt your connection sting in your web.config file. The connection string must all ready be in place.
For C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
-pkm switch encrypts the machine.config rather and web.config (default).
aspnet_regiis.exe -pef "connectionStrings" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config" -prov "DataProtectionConfigurationProvider"
Post Comment Now

