Go Throuth all User Tables and Columns in 2000 Database?
DECLARE @TableName Varchar(50)
DECLARE @ColumnName Varchar(50)

DECLARE @SQL Varchar(500)

DECLARE get_TableName CURSOR FOR
SELECT [TABLE_NAME]
FROM DatabaseName.INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY [TABLE_NAME];

open get_TableName

FETCH NEXT FROM get_TableName INTO @TableName

WHILE @@FETCH_STATUS = 0
Begin

DECLARE get_ColumnName CURSOR FOR
SELECT [COLUMN_NAME]
FROM NPU_INFO.INFORMATION_SCHEMA.COLUMNS
WHERE [TABLE_NAME] = @TableName ORDER BY [COLUMN_NAME];

open get_ColumnName
FETCH NEXT FROM get_ColumnName INTO @ColumnName
WHILE @@FETCH_STATUS = 0
Begin
Print @TableName+'/'+@ColumnName

SET @SQL='What you want to run'
EXEC(@SQL)


FETCH NEXT FROM get_ColumnName INTO @ColumnName
End
CLOSE get_ColumnName
DEALLOCATE get_ColumnName


FETCH NEXT FROM get_TableName INTO @TableName

End

CLOSE get_TableName
DEALLOCATE get_TableName

[ add comment ] ??|??permalink??|??related link??|?? ( 3 / 5299 )
Check SQL Server 2000 Table Usage?
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"

[ add comment ] ??|??permalink??|??related link??|?? ( 2.9 / 5512 )
SQL Server 2000 Update Data Inner Join Another Table?
UPDATE table
SET values
FROM join other tables here.

Example

Update TableA
SET TableA.Col1=TableB.Col1
From TableA INNER JOIN TableB ON TableA.ID=TableB.ID

[ add comment ] ??|??permalink??|??related link??|?? ( 3 / 5324 )