| Author |
Topic |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-13 : 13:59:44
|
OK...I must be going senilebcp [PLS_WORK].[dbo].[ACHLDR_Stage_X150753] in "C:\PLS\Data\PRU_ALLIANCE.txt" -SNJROS1BBLD0304\DEV2K08 -T -c What's wrong with that..in a dos prompt??It's asking me for a password..I even tried my pwd..but to no availnot like I don't do this millions of times...maybe I'm drunk and don't know it? "Nah, Drunks more Fun" -- Phil ConnersBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-13 : 14:01:41
|
| Haven't tried BCP in 2K8 ... but BCP -? should give you the switches? or BOL will. Maybe something has changed subtly?Sorry, only 101-level-help, but just in case you haven't scratched-that-itch it might help? |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-13 : 14:03:03
|
I getquote: C:\>bcp [PLS_WORK].[dbo].[ACHLDR_Stage_X150753] out "C:\test.dat" -SNJROS1BBLD0304\DEV2K08 -T -cPassword:CTLIB Message: - L6/O8/S5/N3/5/0:ct_connect(): directory service layer: internal directory control layer error: Requested server name not found.Establishing connection failed.
And I can ping the serverquote: C:\>ping njros1bbld0304Pinging njros1bbld0304.prudential.com [48.160.98.188] with 32 bytes of data:Reply from 48.160.98.188: bytes=32 time=53ms TTL=120Reply from 48.160.98.188: bytes=32 time=2ms TTL=120Reply from 48.160.98.188: bytes=32 time=2ms TTL=120Reply from 48.160.98.188: bytes=32 time=3ms TTL=120Ping statistics for 48.160.98.188: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 2ms, Maximum = 53ms, Average = 15ms
Is it the "Friday I just don't care to see what's Wong"-itis?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-13 : 14:04:44
|
quote: Originally posted by Kristen Haven't tried BCP in 2K8 ... but BCP -? should give you the switches? or BOL will. Maybe something has changed subtly?Sorry, only 101-level-help, but just in case you haven't scratched-that-itch it might help?
Dude, I've done this in my sleep...Of course I looked at BOL, and yes it also gave me the switches when I mokeyed arounfd in dos (or whatever they're calling it these days)Thanks for the post thoughAnd yes, this is my first 2k8 bcpBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-08-13 : 14:10:19
|
have to add named instance servername in quotes?bcp [PLS_WORK].[dbo].[ACHLDR_Stage_X150753] in "C:\PLS\Data\PRU_ALLIANCE.txt" -S"NJROS1BBLD0304\DEV2K08" -T -c just a guess. i always bcp OUT and Bulk Insert in...let me try it on a named instance... |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-08-13 : 14:26:58
|
| ok, it's not the "\" in the instance name. works for me with and without. but it does matter where i run it from. on my workstation i get failed login with the -T switch. from a different server it works.Network Authority / SPN issue? |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-13 : 14:49:43
|
well you shouldn't..depending on your authorityI'm sa on the box, and I'm using Windows securityWhen I runDECLARE @cmd varchar(8000)SET @cmd = 'bcp [PLS_WORK].[dbo].[ACHLDR_Stage_X150753] out D:\Test.dat -SNJROS1BBLD0304\DEV2K08 -T -c'exec master..xp_cmdshell @cmd I get [/code]output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------SQLState = 37000, NativeError = 4060Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "[PLS_WORK]" requested by the login. The login failed.NULL(3 row(s) affected)[/code]Time for Tequila ShootersBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-13 : 14:53:44
|
I ran thisDECLARE @cmd varchar(8000)SET @cmd = 'bcp [DIVERSITY].[dbo].[USERS] out D:\Test.dat -SPAERSCBVD0403\dev -T -c'exec master..xp_cmdshell @cmd And got this?output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------SQLState = 28000, NativeError = 18456Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'PRUDENTIAL\NJROS1BBLD0304$'.NULL(3 row(s) affected) So it is running under the context of the connection....from SSMSBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-08-13 : 14:57:39
|
| xp_cmdshell runs as sql service account |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-08-13 : 16:39:00
|
| haha yeah, that would do it. or you can call it with the full pathC:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe [PLS_WORK].[dbo].[ACHLDR_Stage_X150753] in "C:\PLS\Data\PRU_ALLIANCE.txt" -S"NJROS1BBLD0304\DEV2K08" -T -c |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-16 : 10:24:04
|
quote: Phil: I'm a god. Rita: You're God? Phil: I'm a god. I'm not the God... I don't think. Rita: You're not a god. You can take my word for it; this is twelve years of Catholic school talking. Phil: Well maybe the real God uses tricks, you know? Maybe he's not omnipotent. He's just been around so long he knows everything.
>> He's just been around so longThat would be me...but I do need a new gigThey (Server Ops/Network/Software Push??) have been messing around quite a bit lately...they just pushed Lotus Notes 8.x...and everything is a mess...Now my T60 is craaaaaawwwwling....Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-16 : 10:25:44
|
quote: Originally posted by tkizer I forgot to mention that once you fix the path, the SQL Server service will need to be restarted in order to see the change. The path gets loaded into its memory, so it won't see the new path until the next startup.
It's just on my client...I was actually helping a SQL server "expert", near shore (IRL), trying to figure out how to get data into a tableBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-16 : 10:41:08
|
Oh, for the love of god"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe" PLS_WORK.dbo.ACHLDR_Stage_X150753 in "C:\PLS\Data\PRU_ALLIANCE.txt" -SNJROS1BBLD0304\DEV2K08 -T -c Success...time for a beer... Starting copy...SQLState = 22001, NativeError = 0Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation1000 rows sent to SQL Server. Total sent: 10001000 rows sent to SQL Server. Total sent: 20002207 rows copied.Network packet size (bytes): 4096Clock Time (ms.) Total : 391 Average : (5644.50 rows per sec.)C:\>C:\> Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-16 : 11:08:34
|
quote: Sajesh,To make life easier...take your excel spreadsheets, and make sure the have data in a format that matches the columns in the databasecreate a staging table, the use bcp.The do a join on these 2 columns...the staging table does not need an index because it will be scanned anyway (being the driver)USE [PLS_Work]GOCREATE TABLE [dbo].[ACHLDR_Stage_X150753]( [acct_ledger] [char](3), [acct_num] [char](5),) ON [PRIMARY]GOThen do the bcp load from cmdshell (>>Run >> CMD). This creates a dos windowThen execute"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe" PLS_WORK.dbo.ACHLDR_Stage_X150753 in "C:\PLS\Data\PRU_ALLIANCE.txt" -SNJROS1BBLD0304\DEV2K08 -T -cYou do this in a dos prompt so it makes sure it uses your credentials, and uses your drive mappingsThen, do your query SELECT * FROM PLS.dbo.ACHLDR aINNER JOIN PLS_WORK.dbo.ACHLDR_Stage_X150753 xxx ON a.acct_ledger = xxx.acct_ledger AND a.acct_num = xxx.acct_numThe other way you were trying..SELECT * FROM ACHLDR WHERE acct_num+acct_ledger IN (SELECT 'XYZ1123' UNION ALLSELECT 'XYZ1123' UNION ALL......20,000 more times)Will only cause a scan...and I wonder about an upper limit on the size of a sql queryTo get the data out, I can help you with that as well...First things first
This was a query that was never coming home...his reply IMquote: yeah got it..that was quick.I modified the query to include all the rows from the stage table..
Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-16 : 11:19:53
|
| Clearly naming the database "Please work ... Pretty pretty please work" was the trick you needed?!! {:D] |
 |
|
|
Next Page
|