Query
We have two informational queries.
info.columns
1 2 3 4 5 6 7 8 9 10 11 12 |
SELECT [INFORMATION_SCHEMA].[COLUMNS].[COLUMN_NAME] , [INFORMATION_SCHEMA].[COLUMNS].[DATA_TYPE] , [INFORMATION_SCHEMA].[COLUMNS].[IS_NULLABLE] , [INFORMATION_SCHEMA].[COLUMNS].[CHARACTER_MAXIMUM_LENGTH] , [INFORMATION_SCHEMA].[COLUMNS].[NUMERIC_PRECISION] , [INFORMATION_SCHEMA].[COLUMNS].[NUMERIC_SCALE] , [INFORMATION_SCHEMA].[COLUMNS].[COLUMN_DEFAULT] , [INFORMATION_SCHEMA].[COLUMNS].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] WHERE [INFORMATION_SCHEMA].[COLUMNS].[TABLE_SCHEMA] = ? AND [INFORMATION_SCHEMA].[COLUMNS].[TABLE_NAME] = ? ; |
File name: query / info.columns.sql
Return the columns meta data for a specified table.
sys.row_count
1 2 3 4 5 |
SELECT SUM(row_count) row_count FROM sys.dm_db_partition_stats WHERE object_id = OBJECT_ID(?) AND index_id < 2 ; |
File name: query / sys.row_count.sql
Shows the row counts for the specified table.
Table Query – Example
1 2 3 4 5 6 7 8 |
SELECT Name , CostRate , Availability , ModifiedDate FROM production.location ORDER BY LocationID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ; |
File name: query / production.location
Need to use placeholders (?) to allow for the OFFSET statement.
Leave a Reply