I have tried many things, but I'm still not getting this to work. Here's the code:
bcp RFID.dbo.ResultsDump format nul -t, -c -x -f C:\RFID.xml -S"ALBERTLAST-PC\SQLEXPRESS" -UAlbert Last -P -T
All I want to do is create an XML format file from ResultsDump table, and the above statement doesn't even work. My username is "Albert Last" where Last is my last name, yet this is what the above statement returns:
bcp: unknown option A
usage: 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
It's thinking that I am asking for option A, because when I put square brackets around Albert Last, here's what I get:
bcp: unknown option [
I've also tried this WITHOUT specifying server name, username, or password, with just -T. This is what I get:
SQLState = 37000, NativeError = 4060
Error = [Microsoft][SQL Native Client][SQL Server]Cannot open database "RFID" requested by the login. The login failed.
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
NULL
I've looked everywhere online and have not seen a similar problem before, and I'm beginning to think that this is just a simple mistake that I'm not catching.
Can somebody help?? Or if there is a way to generate format xml file RFID.xml from table ResultsDump without bcp, that would be greatly appreciated! Thanks in advance!