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
-- A table, "turtles": | |
CREATE TABLE turtles | |
( | |
id serial NOT NULL, | |
name text, | |
lastid integer, | |
CONSTRAINT pk_turtles PRIMARY KEY (id) | |
) | |
WITH ( | |
OIDS=FALSE |
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
public class ApplicationUser : IdentityUser | |
{ | |
[Required] | |
public string FirstName { get; set; } | |
[Required] | |
public string LastName { get; set; } | |
[Required] | |
public string Email { get; set; } |
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 c.relname, c.relkind FROM pg_class c WHERE c.relkind = 'S' and relname = 'album_albumid_seq'; |
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 last_value FROM album_album_id_seq |
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 COUNT(pg_get_serial_sequence('"clientdocuments"', 'ClientDocumentId')) As CountAuto |
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 columnproperty(object_id('Album'),'AlbumId','IsIdentity') AS IsIdentity |
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 COLUMN_NAME, TABLE_NAME | |
from INFORMATION_SCHEMA.COLUMNS | |
where TABLE_SCHEMA = 'dbo' | |
and COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 | |
order by TABLE_NAME |
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 tc.TABLE_NAME, kcu.COLUMN_NAME, kcu.CONSTRAINT_NAME, tc.CONSTRAINT_TYPE, | |
(COLUMNPROPERTY(object_id(tc.TABLE_NAME), kcu.COLUMN_NAME, 'IsIdentity')) AS IsIDColumn | |
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc | |
ON kcu.CONSTRAINT_SCHEMA = tc.CONSTRAINT_SCHEMA AND kcu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME |
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 c.TABLE_NAME, c.COLUMN_NAME, kcu.CONSTRAINT_NAME, c.DATA_TYPE, c.CHARACTER_MAXIMUM_LENGTH, tc.CONSTRAINT_TYPE, | |
CASE tc.CONSTRAINT_TYPE WHEN 'PRIMARY KEY' THEN CAST(1 AS BIt) ELSE CAST(0 AS Bit) END AS IsPrimaryKey, | |
CASE (COLUMNPROPERTY(object_id(tc.TABLE_NAME), kcu.COLUMN_NAME, 'IsIdentity')) WHEN 1 THEN CAST(1 AS BIT) ELSE CAST(0 AS Bit) END as IsAuto | |
FROM INFORMATION_SCHEMA.COLUMNS c | |
LEFT OUTER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu | |
ON c.TABLE_SCHEMA = kcu.CONSTRAINT_SCHEMA AND c.TABLE_NAME = kcu.TABLE_NAME AND c.COLUMN_NAME = kcu.COLUMN_NAME | |
LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc | |
ON kcu.CONSTRAINT_SCHEMA = tc.CONSTRAINT_SCHEMA AND kcu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME |
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 (CASE ( | |
(SELECT CASE (LENGTH(pg_get_serial_sequence('artist', 'artist_id')) > 0) WHEN true THEN 1 ELSE 0 END) + | |
(SELECT CASE (SELECT pgc.relkind FROM pg_class pgc WHERE pgc.relname = 'artist' || '_' || 'artist_id' || '_' || 'seq') WHEN 'S"' THEN 1 ELSE 0 END)) | |
WHEN 0 THEN false ELSE true END) AS IsAuto |