Skip to main content

Posts

Showing posts with the label Query

SQL Queries that i find very handy

The following query determines missing product ids from a sequence of product ids select l . Productid + 1 as start from product as l   left outer join product as r on l . Productid + 1 = r . Productid where r . Productid is null; The following query gives the recently modified stored procedures select name,create_date,modify_date from sys.procedures order by modify_date desc The following query gives me the C# class entity representation of a database table DECLARE @TableName VARCHAR(MAX) = 'NewsItem' -- Replace 'NewsItem' with your table name DECLARE @TableSchema VARCHAR(MAX) = 'dbo' -- Replace 'Markets' with your schema name DECLARE @result varchar(max) = '' SET @result = @result + 'using System;' + CHAR(13) + CHAR(13) IF (@TableSchema IS NOT NULL) BEGIN     SET @result = @result + 'namespace ' + @TableSchema  + CHAR(13) + '{' + CHAR(13) E...