thanks for the immediate response, actually I am creating the temp table in a stored procedure. This procedure is for find the factory production
report all weeks in a year, as the production is based on the orders,I am getting repeat weeks. I solved this problem by using this code
SELECT
SYSCOLUMNS.NAME AS [Column Name]
FROM SYSOBJECTS
INNER JOIN SYSCOLUMNS ON SYSOBJECTS.ID = SYSCOLUMNS.ID
INNER JOIN SYSTYPES ON SYSTYPES.XTYPE = SYSCOLUMNS.XTYPE
WHERE
(OBJECTPROPERTY(SYSOBJECTS.id, N'IsUserTable') = 0
AND SYSCOLUMNS.NAME = @ColumnName
AND SYSOBJECTS.NAME = '##tempWeeklyProduction')
ORDER BY SYSOBJECTS.NAME
thanks
|