This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static string RowToXML(DataRow DRInput) | |
{ | |
DataSet myDS = new DataSet(); | |
myDS.Tables.Add(DRInput.Table.Clone()); | |
myDS.Tables[0].ImportRow(DRInput); | |
return myDS.GetXml(); ; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Insert into [server].database.dbo.table | |
select src.* from table src | |
left join [server].database.dbo.table sta | |
ON sta.Key = src.Key | |
where sta.Key IS NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell -Command "(new-object net.webclient).DownloadString('https://api.ipdata.co')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select AVG(CAST(DATEDIFF(MINUTE,B.TimeStamp,A.TimeStamp) AS int)) AvgTime | |
from tblLoadPoint A | |
OUTER APPLY (SELECT TOP 1 * | |
FROM tblLoadPoint | |
Where TimeStamp < A.TimeStamp | |
Order By TimeStamp DESC) B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRINT (CONVERT( VARCHAR(24), GETDATE(), 121)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF OBJECT_ID(N'SqlHintsDemoDB.dbo.Customers', N'U') IS NOT NULL | |
BEGIN | |
PRINT 'Table Exists' | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF OBJECT_ID('tempdb..#Results') IS NOT NULL DROP TABLE #Results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT db_name() as DATABASE_NAME, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, | |
COLUMN_DEFAULT, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, | |
NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE, | |
DATETIME_PRECISION | |
FROM INFORMATION_SCHEMA.COLUMNS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER INDEX ALL ON Production.Product | |
REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON, | |
STATISTICS_NORECOMPUTE = ON); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_fkeys 'TableName' --Show all foreign key relationships |
NewerOlder