Hello all
i have recently taken over a database which has far too much information
approx 60 million last time i looked. i tried to export some of the data
using BCP but im a getting an error
******
* SQL code
******
declare @.sql varchar(2000)
set dateformat DMY
set @.sql = 'bcp "select * from [dialler data]..bowater where
convert(varchar, cast(callstart as datetime),112) = convert(varchar,
dateadd(mm,-12,getdate()),112)" queryout "f:\bowater_archive.csv" -c -t , -r
\n -T'
exec master..xp_cmdshell @.sql
********
* Error Message
********
SQLState = S1010, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Function sequence error
NULL
is this something to do with the code or am i trying to remove too much?
Many thanks
SImon WhaleTry to do it in batches...
Read this => http://support.microsoft.com/?id=137115
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Simon Whale" wrote:
> Hello all
> i have recently taken over a database which has far too much information
> approx 60 million last time i looked. i tried to export some of the data
> using BCP but im a getting an error
> ******
> * SQL code
> ******
> declare @.sql varchar(2000)
> set dateformat DMY
> set @.sql = 'bcp "select * from [dialler data]..bowater where
> convert(varchar, cast(callstart as datetime),112) = convert(varchar,
> dateadd(mm,-12,getdate()),112)" queryout "f:\bowater_archive.csv" -c -t ,
-r
> \n -T'
> exec master..xp_cmdshell @.sql
>
> ********
> * Error Message
> ********
> SQLState = S1010, NativeError = 0
> Error = [Microsoft][ODBC SQL Server Driver]Function sequence error
> NULL
> is this something to do with the code or am i trying to remove too much?
>
> Many thanks
> SImon Whale
>
>|||Simon Whale (s.whale@.nospam.dsl.pipex.com) writes:
> i have recently taken over a database which has far too much information
> approx 60 million last time i looked. i tried to export some of the data
> using BCP but im a getting an error
> ******
> * SQL code
> ******
> declare @.sql varchar(2000)
> set dateformat DMY
> set @.sql = 'bcp "select * from [dialler data]..bowater where
> convert(varchar, cast(callstart as datetime),112) = convert(varchar,
> dateadd(mm,-12,getdate()),112)" queryout "f:\bowater_archive.csv" -c -t ,
> -r \n -T'
> exec master..xp_cmdshell @.sql
>
> ********
> * Error Message
> ********
> SQLState = S1010, NativeError = 0
> Error = [Microsoft][ODBC SQL Server Driver]Function sequence error
> NULL
> is this something to do with the code or am i trying to remove too much?
The queryout option has a word about it of being problematic. Try to
define a view and run bcp out from that one.
By the way, the SET DATEFORMAT has no effect on your BCP command. Luckily,
it does ont matter since you are wise use format 112 anyway.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
没有评论:
发表评论