This file contains hidden or 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
git init | |
git remote add origin [repo-link] | |
git fetch [repo-link] [branch-name] | |
git checkout -b [branch-name] FETCH_HEAD | |
git add . |
This file contains hidden or 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
CREATE FUNCTION dbo.GetSplitString_CTE | |
( | |
@List VARCHAR(MAX), | |
@Delimiter VARCHAR(255), | |
@ElementNumber int | |
) | |
RETURNS VARCHAR(4000) | |
AS | |
BEGIN |
This file contains hidden or 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
;WITH CTE_RugbyLeague AS( | |
SELECT ProviderMatchId,TeamId,PlayerId ,ROW_NUMBER() OVER (PARTITION BY ProviderMatchId,TeamId,PlayerId ORDER BY ProviderMatchId DESC) AS ROW_NO | |
FROM CTE_RugbyLeague WITH(NOLOCK) | |
) | |
SELECT * | |
FROM CTE_RugbyLeague |
This file contains hidden or 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 CONCAT('|| oldValue.', COLUMN_NAME, ' != ', 'newValue.', COLUMN_NAME) AS dataType | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'[table_name]' |
This file contains hidden or 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 GROUP_CONCAT("m.",COLUMN_NAME) | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_SCHEMA = '[database_name]' AND TABLE_NAME = '[table_name]'; |
This file contains hidden or 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 '"' + COLUMN_NAME + '":'+ | |
CASE WHEN DATA_TYPE='NVARCHAR' THEN '"'+'VARCHAR(' + CAST(ISNULL(CHARACTER_MAXIMUM_LENGTH, 0) AS nvarchar(50))+') ' + | |
CASE WHEN IS_NULLABLE = 'NO' THEN 'NOT NULL' ELSE 'NULL'END+'",' ELSE '"'+DATA_TYPE+'(' + CAST(ISNULL(CHARACTER_MAXIMUM_LENGTH, 0) AS nvarchar(50))+') ' + | |
CASE WHEN IS_NULLABLE = 'NO' THEN ' NOT NULL' ELSE 'NULL'END+'",' | |
END AS JsonFormat | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'[table_name]' |
This file contains hidden or 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 | |
CONCAT(COLUMN_NAME, ' = x.', COLUMN_NAME,',' ) AS [type] | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'[table]' |
This file contains hidden or 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 CASE WHEN DATA_TYPE = 'bigint' THEN CONCAT('public long', IIF(IS_NULLABLE = 'YES', '? ', ' ') , COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'nvarchar' THEN CONCAT('public string', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'int' THEN CONCAT('public int', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'datetime' THEN CONCAT('public DateTime', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'datetime2' THEN CONCAT('public DateTime', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'bit' THEN CONCAT('public bool', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'smallint' THEN CONCAT('public Int16', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; get; }') | |
WHEN DATA_TYPE = 'date' THEN CONCAT('public DateTime', IIF(IS_NULLABLE = 'YES', '? ', ' '), COLUMN_NAME,' { set; |
This file contains hidden or 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 STRING_AGG(CONCAT('"',COLUMN_NAME,'"'),',') AS AsDoubleQoutesCols | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'[table_name]' |
This file contains hidden or 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 STRING_AGG(COLUMN_NAME,',') AS ColNames | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'[table_name]' |
NewerOlder