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
__author__ = 'charles' | |
inputFile = "C-large-practice.in" | |
outputFile = inputFile + ".out" | |
t9map = { | |
'a': ("2", 1) | |
, 'b': ("2", 2) | |
, 'c': ("2", 3) | |
, 'd': ("3", 1) |
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
CREATE FUNCTION ufn_EscapeString(@body NVARCHAR(MAX)) | |
RETURNS NVARCHAR(MAX) | |
AS BEGIN | |
RETURN CAST(N'''' AS NVARCHAR(MAX)) + REPLACE(@body, '''', '''''') + CAST(N'''' AS NVARCHAR(MAX)) | |
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
DECLARE @sql NVARCHAR(MAX) | |
SET @sql = 'SELECT * FROM foo''; DROP TABLE Customers; --' | |
PRINT QUOTENAME(@sql, '''') |
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
DECLARE @sql NVARCHAR(MAX) | |
SET @sql = 'SELECT * FROM foo''; DROP TABLE Customers; --' | |
PRINT QUOTENAME(@sql, '''') |
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 | |
o.[name] AS [Table_Name] | |
, rc.[rows] AS [Data_Rows] | |
, rc.[rows] / CASE WHEN rc.[usedPages] = 0 THEN 1 ELSE CAST(rc.[usedPages] AS FLOAT) END AS [Rows_Per_Page] | |
, ic.[Indexes] AS [DeclaredIndexes] | |
, ROUND(rc.[usedPages] * 8 / 1024.0, 2) AS [Data_Size_MB] | |
, ROUND(ISNULL(ic.[usedPages] * 8, 0) / 1024.0, 2) AS [Index_size_MB] | |
FROM | |
sys.objects AS o | |