Showing posts with label syntax. Show all posts
Showing posts with label syntax. Show all posts

Wednesday, March 21, 2012

ExportData

Hi All ...
I am looking for simple T-SQL syntax for using ExportData method with
Bulkcopy object to export one table in tab delimited, text file format to
C:\TableName.txt. First row of text file should be column headers.
Anybody know offhand?
[TableName].ExportData ?
Thanks for your help ...When you refer to the BulkCopy object and ExportData method, you must be
speaking of Data Management Objects (DMO), which isn't easily called from
T-SQL. The best and most prevalent method of exporting data to a text file
would be to create a DTS package.
"bill_morgan" <billmorgan@.discussions.microsoft.com> wrote in message
news:FD5558FE-CB29-44A6-ADA8-24DD306527CE@.microsoft.com...
> Hi All ...
> I am looking for simple T-SQL syntax for using ExportData method with
> Bulkcopy object to export one table in tab delimited, text file format to
> C:\TableName.txt. First row of text file should be column headers.
> Anybody know offhand?
> [TableName].ExportData ?
> Thanks for your help ...
>
>|||I like to use T-sql script wherever possible, but sounds like this is one of
those times when it's best not to. Thanks for your help.
"JT" wrote:

> When you refer to the BulkCopy object and ExportData method, you must be
> speaking of Data Management Objects (DMO), which isn't easily called from
> T-SQL. The best and most prevalent method of exporting data to a text file
> would be to create a DTS package.
> "bill_morgan" <billmorgan@.discussions.microsoft.com> wrote in message
> news:FD5558FE-CB29-44A6-ADA8-24DD306527CE@.microsoft.com...
>
>

Friday, February 17, 2012

Export Stored procedure to Access Error

When trying to export the output of a stored procedure to an Access database
,
I get the error
"Syntax Error in field definition"
at the first step of the process (output table creation)
The procedure runs fine in QA, and has the following general structure:
...
select * into #MyTempTable
from ...
...
select * ] this is what I need
from ... ] to be the output
join #MyTempTable on ... ] of the procedure
... ]
Could the use of a temporary table be the cause of the problem?Try using SET NOCOUNT ON at the beginning of the procedure.
ML
http://milambda.blogspot.com/|||I did and still get the same error
"ML" wrote:

> Try using SET NOCOUNT ON at the beginning of the procedure.
>

Wednesday, February 15, 2012

Export sp_columns result into a temp table?

Can anyone show me the syntax for exporting the result of sp_columns into a new table?
I've tried using "SELECT EXEC sp_columns...INTO 'column_info'" but I keep getting syntax errors that are unclear to me.
Any help would be greatly appreciated.
abYou need to create a table with the same number of columns as the result set first

Look at

USE Master
GO
sp_helptext sp_columns
GO

to find the detail

Then do INSERT INTO yourTable(cOL LIST) exec SP_Columns TABLE|||Originally posted by Brett Kaiser
You need to create a table with the same number of columns as the result set first

Look at

USE Master
GO
sp_helptext sp_columns
GO

to find the detail

Then do INSERT INTO yourTable(cOL LIST) exec SP_Columns TABLE

I thought a SELECT INTO... type statement would create the table for me?|||It doesn't work for the execution of a sproc...