How to find out to which table the column name belongs to ?


How to find out to which table the column name belongs to ?

Ans:

SELECT TABLE_NAME=SYSOBJECTS.NAME,
COLUMN_NAME=SYSCOLUMNS.NAME,
DATATYPE=SYSTYPES.NAME,
LENGTH=SYSCOLUMNS.LENGTH
FROM SYSOBJECTS
JOIN SYSCOLUMNS ON SYSOBJECTS.ID = SYSCOLUMNS.ID
JOIN SYSTYPES ON SYSCOLUMNS.XTYPE=SYSTYPES.XTYPE
WHERE SYSOBJECTS.XTYPE=’U’
AND SYSCOLUMNS.NAME LIKE (‘COLUMNAME2FIND%’)
ORDER BY SYSOBJECTS.NAME,SYSCOLUMNS.COLID


--keep posting

Comments

Popular posts from this blog

Fedora 32 Setting up Citrix workspace client

Probing element in app.config + Post build event to copy multiple files

List of useful tools(Must have tools/Application)