Xcopy Not Copying All Files In Stored Procedure

Apr 8, 2008

I am executing xcopy with xp_cmdshell in a stored procedure and it is not copying all the files. There are about 600 files in the source directory and only around 190 are copied to the destination.

The command in the stored procedure is this N'xcopy c:source*.* c:dest'

Help please!!!!

Thanks,
Saied

View 14 Replies


ADVERTISEMENT

Copying Table In Stored Procedure

Feb 16, 2001

How can I create a table identical to another one, in a stored procedure?
I need to copy the indexes and constraints too.
Example: I have a table "employee" and I want another table "employee2"
with the same indexes and primary key and references.

I need to do the work in a stored procedure because there are many, many tables, and this process belong to a convertion program.

I can't script the table because this process must be automatic no manual.

Thank you

View 1 Replies View Related

Copying From Stored Procedure To Temptable

Mar 9, 2001

Hi,

Obviously, in a select statement, I can select * into #temptable. But can I do the equivalent from a stored procedure? I do not want to edit the stored procedure, just take the records it returns and put them into the temporary table. I do not know what records are returned by the stroped procedure until it is executed. Is there a way I can do this?
Thanks
J

View 1 Replies View Related

Copying Table In Stored Procedure

Feb 16, 2001

How can I create a table identical to another one, in a stored procedure?
I need to copy the indexes and constraints too.
Example: I have a table "employee" and I want another table "employee2"
with the same indexes and primary key and references.

I need to do the work in a stored procedure because there are many, many tables, and this process belong to a convertion program.

Thank you

View 1 Replies View Related

Stored Procedure (possible To Read Txt Files?)

May 21, 2008

Hi
I have decided to approach the problem here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=103310

by using a Stored procedure, someone mentioned it's possible
for a SP to read the contents of a text file ?

IS it ?

For example i have a DB table
with fields to,from,subject,body

problem is the body field references a file (full path)
and i need to extract all info into a txt file
the full txt body, so can i perform some sort of inner
operation on the select body .. part of the SP ?

View 2 Replies View Related

Stored Procedure To Return All Files In A Folder?

Jul 1, 2006

Hi, I am wondering how can we return each file in a folder ? I am trying to get each file in a folder to perform other job.  Below is the description ...
while folder is not empty
        foreach file
            run the job
        end for
end while
 

View 1 Replies View Related

Copying DAT Files In 6.5

Mar 30, 2000

I have an 8 GB SQL 6.5 database that I need to move to another server. I know I can create the devices and the database on the new server exactly as they were created on the old server then replace the new DAT files with the old (after shuting down SQL Server). The issue I am running into is that the sort order and character sets on the two servers are different. Will this have an effect if I copy the DAT files? Am I better off using BCP? I'd hate to use BCP because of the time that it will take to move the files.

Thanks for you help

View 4 Replies View Related

Copying DB Files

Dec 1, 2005

Hi,
I would like to know where do I copy .mdf and .ldf files, for it to show up on the enterprise manager. I havent created the db using the enterprise manager, but am copying it from another location. So can you tell me what I need to do for this.
thanks

View 5 Replies View Related

Copying Files Over Workgroup

Apr 8, 2004

I want to copy the database backup files to another server as a part of logshipping implementation. tried using xcopy it doesn't work.
it says "invalid drive specification"
also tried using a dll, the dll does the copying i just had to call the dll through an sp, while trying this the QA hanged, tried killing the process but the process didn't kill, i had to restart the service.

the network in not a domain its workgroup.
with sql server 2000 on win2k server.

any inputs are welcome.
thanks in advance
regards,
harshal.

View 5 Replies View Related

Copying Files Between Servers

May 18, 2006

I'm trying to copy files between 2 servers on a local network from within aSQL Job (and Query Analyzer) using xp_cmdshell.xcopy but get an accessdenied message returned.I'm able to successfully do the copy from within a command window so thinkthe problem has something to do with using the default SQL Server accountbut as yet I don't know how to resolve.Any help/suggestions would be much appreciated.

View 1 Replies View Related

SQL Server 2008 :: Copy Multiple CSV Files Into Database Using Stored Procedure?

Feb 9, 2015

I need to import multiple csv files and load into table and everytime new database has to be created .

I was able to create new databases using stored proc

How do i do a bulk insert for all the files at once to insert into tables .

i want to load all the files at once .

View 6 Replies View Related

Copying Backup Files To Different Locations

Oct 25, 2007

I have a maintenace plan that copies production backup files in DR server. The production is mission critical and runs 24/7. We have a round the clock backups. Backups include full backup, differential backups and log backups.

To secure these backup files, I was asked to keep these files in different server at the same time as it goes to DR Server. As I am using maintenace plan for scheduled backups that go to DR server and I had no idea how to incorparate copying these files to another server in the same maintenence plan. I came up with idea using xp_cmdshell stored proc that I attached on the maintenace plan in executeT-SQL statement task. The statement looks like


Exec master..xp_cmdshell 'copy e:DRbackup*.bak \fgh-sql16ackup$'

Above statement copy all backup files on DR server and takes these to remote server called fgh-sql16.

My question here is ....are there any other effective methods to copy backup files simultaneously to different servers via maintenace plan.

Thanks all

View 6 Replies View Related

Saving Or Copying Enterprise Manager Files

Dec 11, 2000

hello all,

Does anyone know know which files Enterprise Manager uses to save the settings (i.e. registered computers and groups)?

I would like to reinstall enterprise manager, but I do not want to reconfigure all of the server registrations.

Thanks,

Matt

View 1 Replies View Related

Integration Services :: Copying Files From One Server To Another

Aug 25, 2015

I am copying files from one server to another and I have specific format for all jpg files. which is in 3 format

filename_reg.jpg,
filename_kat,
filename_pag

and I want to copy _reg files only using file system task.I have already created file sytem task using foreach loop and it is copying files but I want to copy only _reg files.

View 5 Replies View Related

Why Is Simply Copying The Mdf/ldf Files NOT A Good Way To Backup?

Mar 12, 2008

Hi.

What I want to know is what the issues/scenarios are of only using copies of mdf/ldf files as backups.

TIA.

View 3 Replies View Related

DTS: Copying Data From Text Files To A SQL Server Table

Sep 10, 2001

Hi all,

I got a situation here.....

From a source table (in SERVER1) I get ids of candidates and from another source (in SERVER2) I get their CVs (text files stored in various Folders). My destination table (in SERVER3) has two fields, CandidateId & CandidateCV.

I have to transfer the data in above fashion for nearly 1 million records.
How can I write a DTS package which picks up the text file from SERVER2 based on the CandidateId which comes from SERVER1? Probably I need some kind of looping mechanism which changes the candidate id & his CV file.

Can anyone help???

Thanks...

View 2 Replies View Related

Copying Files From A Sharepoint Location To Local Machine Using SSIS

Apr 20, 2007

I have to copy files from a sharepoint or extranet location (basically https://.....) location to my local server using SSIS.



Any kind of early help would be really great.

View 1 Replies View Related

Xcopy

Mar 2, 2004

hi,
I have the following statement:
exec xp_cmdshell 'xcopy f:dataackup est1.bak \server2ackup /c'
it works in command prompt but not in QA. i tried dir on both the machines, it works fine.
harshal.

View 8 Replies View Related

Copying Store Procedure From One Server To All Other Servers

May 22, 2008



HI,

Actally we have different server and we work on only one server and end of the day i have to copy the list of newly or modified procedure to other databases of other server. i have create the following Sp. but i am hving problem int it. please any one can have a look..

Declare @ServerName nvarchar(max)
Declare @DatabaseName nvarchar(max)
Declare @Prod nvarchar(max)
declare @m nvarchar(max)
DECLARE @SERVER nvarchar(max)
Declare @String nvarchar(max)

DECLARE @sp VARCHAR(MAX)
SELECT @sp = OBJECT_DEFINITION(OBJECT_ID('SPNAMEMOD'))
SET @Prod = 'SPNAMEMOD'

DECLARE ProcedureScripingCursor CURSOR FOR
SELECT SQLServer,DatabaseName FROM databaseListName

-- where sqlserver is ip address and databasename is databasename on that server

OPEN ProcedureScripingCursor
FETCH NEXT FROM ProcedureScripingCursor
INTO @ServerName, @DatabaseName
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @sp = REPLACE(@sp,'''','''''')

Set @String = 'execute [' + @ServerName + '].' + @DatabaseName +'.sys.sp_executesql N'''
Set @M = 'execute [' + @ServerName + '].' + @DatabaseName +'.sys.sp_executesql N'''

SELECT @M = @M + ' IF EXISTS (SELECT * FROM sys.objects where NAME = '''''+ @Prod + ''''') DROP PROCEDURE ' + @Prod +' '''

select @string = @string + ' ' + @sp + ' '''

SELECT @M
select @string
PRINT @M
-- Print @string

EXEC sp_Executesql @M
exec sp_Executesql @string

FETCH NEXT FROM ProcedureScripingCursor
INTO @ServerName, @DatabaseName
END

CLOSE ProcedureScripingCursor
DEALLOCATE ProcedureScripingCursor



View 2 Replies View Related

Copying Stored Procedures?

Nov 19, 2004

Hi all, is there a way I can simply copy the stored procedures in one DB, and "paste" them over into another DB that is identical? Thanks!

View 2 Replies View Related

Copying Stored Procedures

Jan 30, 2008

I am trying to make a copy of my live MSSQL 2005 Database to my local Developer Edition install.

To copy the whole database, I am using MS Database Publishing Wizard. I am able to copy the tables and data without problem, but after generating the sql file and running the query against the local db to copy everything, I get errors for the stored procedures.

The stored procedures name is preceded by a login, for instance:
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [matthews].[proc_allitemswithtaxologykeylist]
( @list varchar(7777) )
AS (sql code below)

I have created the user "matthews" on the local instance and given the account DBO role membership in the database. What else do I need to do?

Is there a better way to synch live databases with a local install, perhaps from within management studio itself? I am more experienced with enterprise manager, but 2005 won't let you connect with it.

Thank you for any help.

View 3 Replies View Related

Copying Stored Procedures

Apr 14, 2006

Hi, Could someone please advise me of how to copy stored procedures from one database to another?



Many thanks,

James

View 1 Replies View Related

Can I XCopy SQL CE 3.5? Yes And No, See Message.

Jan 31, 2008

I was hoping to upgrade my SQL CE from 3 to 3.5 for my PPC and desktop applications. However, when I went to XCopy to another desktop I got errors. First, error was that the System.Data.SqlServerCe.dll is not enough, so I copied the other dlls too. Then I got provider not installed error. I do not want to install, I just want to XCopy.
So I searched the newsgroups and online help. I tested using ClickOnce and that worked only because it installed SQL CE for me... but I want to just XCopy.
Next I commented out my code that uses LINQ and just used the old data adapter way to get data and it worked.
I use the same connection string:
"Data Source=C:=test.sdf;Password=sa2008;Persist Security Info=True;Encryption Mode=PPC2003 Compatibility;Max Database Size=4000"


1. Using old way to get data works with XCopy
2. Using LINQ way to get data DOES NOT work with XCopy

Seems that LINQ requires that SQL CE be installed on the desktop to work.
Is this true?


(I know LINQ is not support with SQL CE at this time, but it's sure nice to use)

One other problem I noticed is that I can compile and run my LINQ to SQL CE solution just fine in VS.Net 2008 express, but the same solution gives me a compile error without details as to why when compiled in VS.Net 2008 Pro.

,,,Bydia

View 11 Replies View Related

Calling A Stored Procedure Inside Another Stored Procedure (or Nested Stored Procedures)

Nov 1, 2007

Hi all - I'm trying to optimized my stored procedures to be a bit easier to maintain, and am sure this is possible, not am very unclear on the syntax to doing this correctly.  For example, I have a simple stored procedure that takes a string as a parameter, and returns its resolved index that corresponds to a record in my database. ie
exec dbo.DeriveStatusID 'Created'
returns an int value as 1
(performed by "SELECT statusID FROM statusList WHERE statusName= 'Created') 
but I also have a second stored procedure that needs to make reference to this procedure first, in order to resolve an id - ie:
exec dbo.AddProduct_Insert 'widget1'
which currently performs:SET @statusID = (SELECT statusID FROM statusList WHERE statusName='Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
I want to simply the insert to perform (in one sproc):
SET @statusID = EXEC deriveStatusID ('Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
This works fine if I call this stored procedure in code first, then pass it to the second stored procedure, but NOT if it is reference in the second stored procedure directly (I end up with an empty value for @statusID in this example).
My actual "Insert" stored procedures are far more complicated, but I am working towards lightening the business logic in my application ( it shouldn't have to pre-vet the data prior to executing a valid insert). 
Hopefully this makes some sense - it doesn't seem right to me that this is impossible, and am fairly sure I'm just missing some simple syntax - can anyone assist?
 

View 1 Replies View Related

Copying Stored Procedures Fails

May 10, 2001

Hello,

When I transfer/copy tables from one database to another (on the same SQL Server), everything is fine. When I try to tranfer/copy Stored Procedures, I get the error message:
"Failed to copy objects from Microsoft SQL Server to Microsoft SQL Server."

I am using the DTS import/export wizard to do this.

Thanks,
Bruce

View 2 Replies View Related

Copying Stored Procs With The DTS Wizard

Oct 3, 2001

Hi All,

I have been abloe to copy tables from one db to another, but am getting a "Failed to copy objects" error when trying to import stored procs. can anyone please tell me what I'm doing wrong?

TIA,
Bruce

View 3 Replies View Related

Copying Data Into Another Table Using A Stored Pro

Apr 19, 2007

Can i do something like this

INSERT INTO CITIBANK.dbo.Contract (*)
FROM exec sp..

where sp is the stored procedure ?

Or do i need to specify all the colums where the * is ?
and if so is it the columns from the SP or the colums
from the destination table ?

View 4 Replies View Related

Copying Encrypted Stored Procedures.

Mar 24, 2006

I have several stored procedures, created in a development environment,that I need to move to a 'QA' environment, and then in turn, to variousproduction environments.When I move these stored procedures, I would like to encrypt them,using the 'WITH ENCRYPTION' clause.My question is, how do I copy these stored procedures from developmentto their target SQL server environment in an encrypted state?Up until now, we have been moving them by generating an SQL script andthen executing that script on the target server. I have tried thisusing a script with 'WITH ENCRYPTION' specified within it, but itdoesn't appear to work when I try and execute that script on the targetserver.Any advice would be greatly appreciated.Nick.

View 1 Replies View Related

Copying Stored Procedures From One Database To Another

Apr 19, 2007

How do i copy Stored Procedures from one SQL Express database to another?

View 8 Replies View Related

Xp_cmdshell With Xcopy Returns 2, Why?

Apr 8, 2008

According to the documentation, xp_cmdshell returns 0 if success or 1 if it fails, so I was curious as to why I was getting a return value of 2 when using it with xcopy. So in my t-sql code, if I have something like

@result = master..xp_cmdshell 'xcopy c: est.txt c:Program Files'

The result would return 2. Then if I check if @Result is not equal to 0, it would say their is an error when I am not sure if there was one. I did read on a faq that xcopy expects input from the user, which is normally provided at the command prompt through a return after the command and this behavior can me mimicked by adding "< NUL:" after the command text, which will effectively signal the XCOPY input stream, so the above command becomes:


@result = master..xp_cmdshell 'xcopy c: est.txt c:Program Files < NUL: '

I am still unsure why the @result would return a 2 though?
Also, if I am not going into any subdirectories, is their an advantage of copy over xcopy and vice versa?

If anyone has any info, please let me know, I am using Sql Server 2000.

Thanks in advance,
XaiSoft

View 4 Replies View Related

Xcopy Can Not Copy File From Another Computer

Oct 18, 2007

sql server 2000

when I run under SQL in sql analyser



exec master.dbo.xp_cmdshell 'c:mssqldata est_data_mdf \server1data /y'

return : invalid drive specification

but I can run 'c:mssqldata est_data_mdf \server1data /y' from CMD

any solution?

Thx

View 1 Replies View Related

SQL Express XCopy Deployment Under Vista

Nov 28, 2006

We are in the process of converting our MSDE-enabled products to using SQL Express for compatability with Vista. With help from the msdn article at http://msdn2.microsoft.com/en-us/library/ms165716.aspx I've been able to create a test install that works fine under XP, but fails under Vista. We have our application installing under the "Program Files" directory, and are copying the database's MDF file into the same directory. We are using AttachDbFileName to connect to the database and under XP the LDF file is created fine. Under Vista we receive an error that the database cannot be attached and I've noticed that the LDF file is not being created. I was receiving the exact same error under XP until I removed the LDF file from the install and allowed SQL Express to create it. I'm guessing that it is an issue in the permissions necessary to write the LDF file out to the applications directory, but that's just a guess. So, I was wondering what the Microsoft recommended method for doing a SQL Express XCopy deployment under Vista was?

View 2 Replies View Related

Issues With Moving Backups Via XCopy

Jun 9, 2006

When we take backups, we xcopy them from a folder (on a remote server) containing all of the backups for the databases on that server accross a network onto a central server, into a folder for that server/database. However, should one of the backups we have moved accross the network and onto the central server get deleted or moved, the XCopy does not attempt to move the copy from the remote server back onto the central server the next time we run the procedure...so is there a setting that essentially states, "sync up the source and destination, in order to make the destination match the host"? and what causes XCopy to ignore the files it previously moved into the destination? Is it a property on the file? Any advice?

thanks in advance!

SQL Server 2000

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved