Thursday, April 26, 2007

User Parameter in View

create function dbo.MyFunc (@parm int)
returns table
as
return (
select col1, col2
from dbo.MyTable
where idcol > @parm
)

select col1, col2 from dbo.MyFunc(5)




http://www.thescripts.com/forum/thread79868.html



http://www.thescripts.com/for
um/thread79868.html

Tuesday, April 24, 2007

Rebuild Index SQL Server 2000

USE sfcr --Enter the name of the database you want to reindex

DECLARE @TableName varchar(255)

DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'base table'

OPEN TableCursor

FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END

CLOSE TableCursor

DEALLOCATE TableCursor

Debug SQL Server

http://www.15seconds.com/Issue/050106.htm