| Author |
Topic |
|
Bill_C
Constraint Violating Yak Guru
299 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-27 : 10:40:07
|
| it works with sql 2005. did you try it? Did you get any error? |
 |
|
|
Bill_C
Constraint Violating Yak Guru
299 Posts |
Posted - 2008-10-27 : 10:44:10
|
| yes, it errored when I tried to send the data to an external source:-EXEC proc_generate_excel_with_columns 'databasename', 'viewname','\\servername\sharename'any ideas please? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-27 : 10:52:48
|
| what was the error message? |
 |
|
|
Bill_C
Constraint Violating Yak Guru
299 Posts |
Posted - 2008-10-27 : 10:54:50
|
| This is message:-output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------User name not provided, either use -U to provide the user name or use -T for Trusted Connectionusage: bcp {dbtable | query} {in | out | queryout | format} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n native type] [-c character type] [-w wide character type] [-N keep non-text native] [-V file format version] [-q quoted identifier] [-C code page specifier] [-t field terminator] [-r row terminator] [-i inputfile] [-o outfile] [-a packetsize] [-S server name] [-U username] [-P password] [-T trusted connection] [-v version] [-R regional enable] [-k keep null values] [-E keep identity values] [-h "load hints"] [-x generate xml format file]NULL(13 row(s) affected)output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------User name not provided, either use -U to provide the user name or use -T for Trusted Connectionusage: bcp {dbtable | query} {in | out | queryout | format} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n native type] [-c character type] [-w wide character type] [-N keep non-text native] [-V file format version] [-q quoted identifier] [-C code page specifier] [-t field terminator] [-r row terminator] [-i inputfile] [-o outfile] [-a packetsize] [-S server name] [-U username] [-P password] [-T trusted connection] [-v version] [-R regional enable] [-k keep null values] [-E keep identity values] [-h "load hints"] [-x generate xml format file]NULL(13 row(s) affected)output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------The system cannot find the path specified.NULL(2 row(s) affected)output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------The system cannot find the path specified.NULL(2 row(s) affected)output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------User name not provided, either use -U to provide the user name or use -T for Trusted Connectionusage: bcp {dbtable | query} {in | out | queryout | format} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n native type] [-c character type] [-w wide character type] [-N keep non-text native] [-V file format version] [-q quoted identifier] [-C code page specifier] [-t field terminator] [-r row terminator] [-i inputfile] [-o outfile] [-a packetsize] [-S server name] [-U username] [-P password] [-T trusted connection] [-v version] [-R regional enable] [-k keep null values] [-E keep identity values] [-h "load hints"] [-x generate xml format file]NULL(13 row(s) affected) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-27 : 11:03:18
|
| did you provide a username as specified in error? |
 |
|
|
Bill_C
Constraint Violating Yak Guru
299 Posts |
Posted - 2008-10-27 : 11:07:53
|
| How?, in what format?like this?EXEC proc_generate_excel_with_columns 'databasename', 'viewname','\\servername\sharename;Username=myusername;pwd=mypwd'does not work? |
 |
|
|
Bill_C
Constraint Violating Yak Guru
299 Posts |
Posted - 2008-10-28 : 05:25:17
|
| I'm still not having any luck with this, could it be a permissions problem or am I using the wrong syntax? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-28 : 05:30:01
|
You are using wrong syntax.See Books Online about the various setting for BCP command. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Bill_C
Constraint Violating Yak Guru
299 Posts |
Posted - 2008-10-28 : 05:44:15
|
| OK, thankscould i embed the username and password into the function in the end of these lines?set @sql='exec master..xp_cmdshell ''bcp " select * from (select '+@columns+') as t" queryout "'+@file_name+'" -c'''set @sql='exec master..xp_cmdshell ''bcp "select * from '+@db_name+'..'+@table_name+'" queryout "'+@data_file+'" -c''' |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
travaz
Starting Member
2 Posts |
Posted - 2008-10-28 : 12:06:17
|
quote: Originally posted by visakh16 did you provide a username as specified in error?
Hi, I have the same problem described by Bill_C.I'm using the user sa, how can I provide that username on the execution of the sp? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-28 : 12:08:44
|
| you mean with bcp? just use -U switch as shown in syntax. |
 |
|
|
travaz
Starting Member
2 Posts |
Posted - 2008-10-28 : 12:38:12
|
| Thanks visakh16 now it works.I used the option -T and it doesn't give me any more error.Bye |
 |
|
|
|