Tuesday, October 14, 2008

A couple of SQL Server Tricks

CREATE TABLE myTable(Document varbinary(max))

INSERT INTO myTable(Document)
SELECT * FROM
OPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB)



This stored procedure uses the XP_Cmdshell command, which by default is disabled. You have to enable it using sp_configure as shown below:

EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE with override
GO


Here's an ASP.NET GridView freebie.

No comments:

Post a Comment

Older Posts