|
CREATE PROCEDURE
GET_TABLENAME
AS
SELECT
TABLE_NAME as 'WASTE'
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABlE_TYPE='BASE TABLE' AND
TABLE_NAME <> 'dtproperties'
GO
CREATE PROCEDURE GET_METADATA
@TABLE_NAME VARCHAR(200)
AS
SELECT
COLUMN_NAME,
DATA_TYPE,
IS_NULLABLE,
isnull(CHARACTER_MAXIMUM_LENGTH,0),
ISNULL((SELECT 'Y' FROM SYSFOREIGNKEYS WHERE FKEYID =ID AND FKEY=COLID),'N') as 'IsForeignKey',
Ordinal_Position
FROM
SYSCOLUMNS,
(SELECT
COLUMN_NAME,
IS_NULLABLE,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
Ordinal_Position
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME =@Table_Name) AS A
WHERE
ID
IN
(SELECT
ID
FROM
SYSOBJECTS
WHERE
TYPE='U'
AND NAME =@Table_Name
)
AND
A.COLUMN_NAME =NAME
Order By
Ordinal_Position
GO
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Balachandar Ganesan has been working in CGI India for the last 6 years. ASP.NET, SQL Server 2000, Crystal Reports, Database Performance tuning, ETL, Actuate, Cobol, CICS,DB2, Easytrieve, Flash, PaintShop Pro , SoundForge are few of the various technologies with which he has worked.
He is known for ability to generate applications with "just good enough" features in a short time.
He has written whitepapers on Software development process improvement as well.
Image, Video and Audio editing are his hobbies. He is also the editor of his company newsletter, Manager of cricket and volleyball teams, Vice-President of Toastmasters club.