Fix #153: Fixing sql snippets that failed on a DB with case-sensitive collation. (#152)

* Fixing sql snippets that failed on DBs that are case sensitive.

* Adding .vs/ (Visual Studio Code project dir) to .gitignore.

* Fixing typo.
This commit is contained in:
Stefán Jökull Sigurðarson
2017-11-20 21:49:33 +00:00
committed by Kevin Cunnane
parent 01d3fe6077
commit 7498e3a6da
2 changed files with 15 additions and 14 deletions

1
.gitignore vendored
View File

@@ -16,6 +16,7 @@ test-reports
.vscode-test .vscode-test
node_modules/ node_modules/
.build/ .build/
.vs/
out/ out/
out-build/ out-build/
out-editor/ out-editor/

View File

@@ -226,10 +226,10 @@
"body": [ "body": [
"-- Get a list of tables and views in the current database", "-- Get a list of tables and views in the current database",
"SELECT table_catalog [database], table_schema [schema], table_name name, table_type type", "SELECT table_catalog [database], table_schema [schema], table_name name, table_type type",
"FROM information_schema.tables", "FROM INFORMATION_SCHEMA.TABLES",
"GO" "GO"
], ],
"description": "List tables and vies in the current database" "description": "List tables and views in the current database"
}, },
"List databases": { "List databases": {
@@ -247,15 +247,15 @@
"body": [ "body": [
"-- List columns in all tables whose name is like '${1:TableName}'", "-- List columns in all tables whose name is like '${1:TableName}'",
"SELECT ", "SELECT ",
"\tTableName = tbl.table_schema + '.' + tbl.table_name, ", "\tTableName = tbl.TABLE_SCHEMA + '.' + tbl.TABLE_NAME, ",
"\tColumnName = col.column_name, ", "\tColumnName = col.COLUMN_NAME, ",
"\tColumnDataType = col.data_type", "\tColumnDataType = col.DATA_TYPE",
"FROM information_schema.tables tbl", "FROM INFORMATION_SCHEMA.TABLES tbl",
"INNER JOIN information_schema.columns col ", "INNER JOIN INFORMATION_SCHEMA.COLUMNS col ",
"\tON col.table_name = tbl.table_name", "\tON col.TABLE_NAME = tbl.TABLE_NAME",
"\tAND col.table_schema = tbl.table_schema", "\tAND col.TABLE_SCHEMA = tbl.TABLE_SCHEMA",
"", "",
"WHERE tbl.table_type = 'base table' and tbl.table_name like '%${1:TableName}%'", "WHERE tbl.TABLE_TYPE = 'BASE TABLE' and tbl.TABLE_NAME like '%${1:TableName}%'",
"GO" "GO"
], ],
"description": "Lists all the columns and their types for tables matching a LIKE statement" "description": "Lists all the columns and their types for tables matching a LIKE statement"
@@ -274,13 +274,13 @@
"(SUM(ALOC.total_pages)*8/1024) AS total_space_MB,", "(SUM(ALOC.total_pages)*8/1024) AS total_space_MB,",
"(SUM(ALOC.used_pages)*8/1024) AS used_space_MB,", "(SUM(ALOC.used_pages)*8/1024) AS used_space_MB,",
"(SUM(ALOC.data_pages)*8/1024) AS data_space_MB", "(SUM(ALOC.data_pages)*8/1024) AS data_space_MB",
"FROM sys.Tables AS TABL", "FROM sys.tables AS TABL",
"INNER JOIN sys.Indexes AS INDX", "INNER JOIN sys.indexes AS INDX",
"ON TABL.object_id = INDX.object_id", "ON TABL.object_id = INDX.object_id",
"INNER JOIN sys.Partitions AS PART", "INNER JOIN sys.partitions AS PART",
"ON INDX.object_id = PART.object_id", "ON INDX.object_id = PART.object_id",
"AND INDX.index_id = PART.index_id", "AND INDX.index_id = PART.index_id",
"INNER JOIN sys.Allocation_Units AS ALOC", "INNER JOIN sys.allocation_units AS ALOC",
"ON PART.partition_id = ALOC.container_id", "ON PART.partition_id = ALOC.container_id",
"WHERE TABL.name LIKE '%${1:TableName}%'", "WHERE TABL.name LIKE '%${1:TableName}%'",
"AND INDX.object_id > 255", "AND INDX.object_id > 255",