I sugest using DTS, BCP, OSQL or ISQL to export. They are well docuented in SQL Books Online. There are other techniques outlined in Neil Pike's FAQ at
--===================================
-- This procedure writes the result from a query to a file.
-- The procedure takes the following parameters:
-- @db SYSNAME (required) : the database where the query will be executed.
-- @query VARCHAR(255) (required): the query to be executed.
-- @file (VARCHAR(255) (required): the filename to output to
--===================================
SET NOCOUNT ON
--Get version number and verify supported version
DECLARE @ver VARCHAR(7)
SELECT @ver = CASE
WHEN CHARINDEX('6.50', @@VERSION) > 0 THEN '6.50'
WHEN CHARINDEX('7.00', @@VERSION) > 0 THEN '7.00'
WHEN CHARINDEX('8.00', @@VERSION) > 0 THEN '8.00'
ELSE 'Unknown'
END
IF @ver = 'Unknown'
BEGIN
RAISERROR('Unsupported version of SQL Server.',16,1)
RETURN -101
END
--ADD The No Count on parameter to query to remove row affected count
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.