Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use master..xp_cmdshell ???/

Status
Not open for further replies.

nmmure

Programmer
Joined
Jun 8, 2006
Messages
200
Location
US
Hi,

How to read text file data using

"master..xp_cmdshell" command. my text file is having data

1090
2123
2345

file name is data.txt

i need to save data into my SQL Server 2000 table, table name is "Data"

i don't Admin rights, i have only user rights. I tried for this using "Bulk Insert", it is asking me to sysadmin rights. my dba is not providing me that rights..

Please help me..

thanks in advance
Mure
 
xp.Cmd_shell is not used for reading files. It is only used for DOS/Command Shell manipulation such as moving files or creating directories or reading what files are in a directory (which is different from reading the directory itself).

If you don't have the ability to use BULK INSERT, BCP or create a DTS / SSIS package to import the file into SQL, then you have a problem. You'll need to get with the Sysadmin to discuss your task needs.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Hi,

Pls guide me how to use "BCP". here my problem was.. my application users run the front end.. in the i have only one option..
there i can run only stored procedure ( front end is accepted parameter as Stored Procedure)it is not accepting DTS package..

Pls guide how to solve this problem..

thanks in advance
Mure
 
If you are running SQL 2000 or later your system can grant you access to the bulkadmin which will allow you do do bulk inserts. If you are using SQL 7 or earlier then you will not be able to use the bulk insert without the sysadmin right.

Odds are your dba has locked you out of using xp_cmdshell as well.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Definitely check with the DBA to see what options he/she has for you. DTS packages can be run from a command line prompt, but if xp_cmdshell has been locked down and the application "user" doesn't have permissions to run DTS packages from a command line (I believe the command prompt can be accessed via any properly written CRL), then you're SOL without the DBA's help.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top