Monday, March 26, 2012
Iterate through a list of files with bcp
010301.txt, etc.
I have a working bcp command that points to a specific file.
declare @.bcpCommand varchar(1000)
select @.bcpCommand = 'BCP "Import.dbo.NAV" in
"d:\folder\010101.txt" -c -T -t, -S "SERVER1\SERVER1"'
EXEC master.dbo.xp_cmdshell @.bcpCommand
How can I script the bcp command so it will import all files between say
010101 and 120105? Complicating factor; there are gaps in the sequence. Can
the script continue even if it doesn't find a file?
Alternatively, if it was possible to issue the bcp command against all files
in a folder no matter what the filename, that would work also.
This is a one-time data load with SQL Server 2000/SP4
Thanks to anyone who could help.For sake of simplicity, write a cursor script & get it off. Here is a quick
try:
DECLARE @.cmd VARCHAR(500), @.c VARCHAR(500)
CREATE TABLE #t ( c VARCHAR( 500 ) NOT NULL )
INSERT #t EXEC master.dbo.xp_cmdshell 'DIR d:\folder\*.txt /B'
DECLARE c CURSOR FOR SELECT f FROM #t
OPEN c
FETCH NEXT FROM c INTO @.c
WHILE @.@.FETCH_STATUS = 0
BEGIN
SET @.cmd = 'BCP "Import.dbo.NAV" in "d:\folder\' + @.c + '" -c -T -t, -S
"SERVER1\SERVER1"'
EXEC master.dbo.xp_cmdshell @.cmd
FETCH NEXT FROM c
END
CLOSE c
DEALLOCATE c
DROP TABLE #t ;
Anithsql
Friday, March 23, 2012
Issues with too many audittrace .trc files
I am running MSD 2005 Express Sequel Server and am noticing that in
the data folder located under C:\Program Files\Microsoft SQL Server
\MSSQL.1\MSSQL\Data, that every 3 hours or so a .trc file (I am
assuming it is some sort of log file) is being created. Here is a
sample title of what the file is labled:
audittrace20070618090810_328.trc. These files are big, at least
200,000KB, and are taking up way too much space in my hard drive.
Does any body here know the source for these files? What type of file
is it or neccessary for? I am assuming there is some stored process in
the sequel server that is creating these big files. I am just not sure
where to find that process or where the command is coming from.
Any help is much appreciated. Thanks in advance!
JonathanIt is the "default trace", a Profile trace. You can turn it off using sp_con
figure. If you want to
check what events and columns it traces, see:
http://sqlblog.com/blogs/tibor_kara...
ce.aspx
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<ridingtime516@.gmail.com> wrote in message
news:1184615740.955056.40490@.o61g2000hsh.googlegroups.com...
> Hi
> I am running MSD 2005 Express Sequel Server and am noticing that in
> the data folder located under C:\Program Files\Microsoft SQL Server
> \MSSQL.1\MSSQL\Data, that every 3 hours or so a .trc file (I am
> assuming it is some sort of log file) is being created. Here is a
> sample title of what the file is labled:
> audittrace20070618090810_328.trc. These files are big, at least
> 200,000KB, and are taking up way too much space in my hard drive.
> Does any body here know the source for these files? What type of file
> is it or neccessary for? I am assuming there is some stored process in
> the sequel server that is creating these big files. I am just not sure
> where to find that process or where the command is coming from.
> Any help is much appreciated. Thanks in advance!
> Jonathan
>sql
Issues with too many audittrace .trc files
I am running MSD 2005 Express Sequel Server and am noticing that in
the data folder located under C:\Program Files\Microsoft SQL Server
\MSSQL.1\MSSQL\Data, that every 3 hours or so a .trc file (I am
assuming it is some sort of log file) is being created. Here is a
sample title of what the file is labled:
audittrace20070618090810_328.trc. These files are big, at least
200,000KB, and are taking up way too much space in my hard drive.
Does any body here know the source for these files? What type of file
is it or neccessary for? I am assuming there is some stored process in
the sequel server that is creating these big files. I am just not sure
where to find that process or where the command is coming from.
Any help is much appreciated. Thanks in advance!
Jonathan
It is the "default trace", a Profile trace. You can turn it off using sp_configure. If you want to
check what events and columns it traces, see:
http://sqlblog.com/blogs/tibor_karaszi/archive/2007/03/12/whats-in-the-default-trace.aspx
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<ridingtime516@.gmail.com> wrote in message
news:1184615740.955056.40490@.o61g2000hsh.googlegro ups.com...
> Hi
> I am running MSD 2005 Express Sequel Server and am noticing that in
> the data folder located under C:\Program Files\Microsoft SQL Server
> \MSSQL.1\MSSQL\Data, that every 3 hours or so a .trc file (I am
> assuming it is some sort of log file) is being created. Here is a
> sample title of what the file is labled:
> audittrace20070618090810_328.trc. These files are big, at least
> 200,000KB, and are taking up way too much space in my hard drive.
> Does any body here know the source for these files? What type of file
> is it or neccessary for? I am assuming there is some stored process in
> the sequel server that is creating these big files. I am just not sure
> where to find that process or where the command is coming from.
> Any help is much appreciated. Thanks in advance!
> Jonathan
>
Wednesday, March 21, 2012
Issues with too many audittrace .trc files
I am running MSD 2005 Express Sequel Server and am noticing that in
the data folder located under C:\Program Files\Microsoft SQL Server
\MSSQL.1\MSSQL\Data, that every 3 hours or so a .trc file (I am
assuming it is some sort of log file) is being created. Here is a
sample title of what the file is labled:
audittrace20070618090810_328.trc. These files are big, at least
200,000KB, and are taking up way too much space in my hard drive.
Does any body here know the source for these files? What type of file
is it or neccessary for? I am assuming there is some stored process in
the sequel server that is creating these big files. I am just not sure
where to find that process or where the command is coming from.
Any help is much appreciated. Thanks in advance!
JonathanIt is the "default trace", a Profile trace. You can turn it off using sp_configure. If you want to
check what events and columns it traces, see:
http://sqlblog.com/blogs/tibor_karaszi/archive/2007/03/12/whats-in-the-default-trace.aspx
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<ridingtime516@.gmail.com> wrote in message
news:1184615740.955056.40490@.o61g2000hsh.googlegroups.com...
> Hi
> I am running MSD 2005 Express Sequel Server and am noticing that in
> the data folder located under C:\Program Files\Microsoft SQL Server
> \MSSQL.1\MSSQL\Data, that every 3 hours or so a .trc file (I am
> assuming it is some sort of log file) is being created. Here is a
> sample title of what the file is labled:
> audittrace20070618090810_328.trc. These files are big, at least
> 200,000KB, and are taking up way too much space in my hard drive.
> Does any body here know the source for these files? What type of file
> is it or neccessary for? I am assuming there is some stored process in
> the sequel server that is creating these big files. I am just not sure
> where to find that process or where the command is coming from.
> Any help is much appreciated. Thanks in advance!
> Jonathan
>
Issues with moving backups via XCopy
thanks in advance!
SQL Server 2000
Normally, XCOPY just copies all specified files to the destination. It is not a sophisticated sync mechanism.
If you can give us the exact XCOPY command you're using, perhaps a different setting of the flags would accomplish what you need it to.
|||can I suggest you look at robocopy, this is, imho, a far superior copy utility that I've been using since way back.|||I just thought I would add my experiences with robocopy. I have been fighting the ability to give it a path containing spaces. Typically I would accomplish this feat by placing quotes around each path but this didn't seem to be working for robocopy.
I have a habit of ending all my paths with a "\" and discovered that robocopy interperets a \" as an escaped quote. The program works great and functions exactly how I would expect if I simply remove the trailing backslash.
I found this functionality to be very strange considering I have never experienced the problem with any other microsoft command line utilities. Not only that but a quote isn't even a valid character in a folder or file so it isn't possible that the path would contain them.
Issues with moving backups via XCopy
thanks in advance!
SQL Server 2000
Normally, XCOPY just copies all specified files to the destination. It is not a sophisticated sync mechanism.
If you can give us the exact XCOPY command you're using, perhaps a different setting of the flags would accomplish what you need it to.
|||can I suggest you look at robocopy, this is, imho, a far superior copy utility that I've been using since way back.|||I just thought I would add my experiences with robocopy. I have been fighting the ability to give it a path containing spaces. Typically I would accomplish this feat by placing quotes around each path but this didn't seem to be working for robocopy.
I have a habit of ending all my paths with a "\" and discovered that robocopy interperets a \" as an escaped quote. The program works great and functions exactly how I would expect if I simply remove the trailing backslash.
I found this functionality to be very strange considering I have never experienced the problem with any other microsoft command line utilities. Not only that but a quote isn't even a valid character in a folder or file so it isn't possible that the path would contain them.
Friday, March 9, 2012
Issue with Report Manager after SP 2 install
level by checking multiple files and hitting the delete button. It
use to work but after SP2, the script behind the button no longer
works.
Is anyone experiencing the same issue?
Thanks,
TWe have the same problem - actually, we can't delete any reports, not just
multiple reports.
I found a post on a web site that says that it is a known problem with the
SP2 CTP and will be fixed in the final SP2 release.
<tuong.k.lam@.gmail.com> wrote in message
news:1170293384.531044.128600@.k78g2000cwa.googlegroups.com...
> I'm trying to delete reports using Report Manager from the folder
> level by checking multiple files and hitting the delete button. It
> use to work but after SP2, the script behind the button no longer
> works.
> Is anyone experiencing the same issue?
> Thanks,
> T
>|||Thanks DJX,
Can you post the website where you saw the problem, if you can
remember.
Wednesday, March 7, 2012
Issue with File System Task and folder locking
I'm having an issue where a folder that I'm accessing in an SSIS package gets locked up and cannot be deleted by my package later in the process.
1) I use a File System task to rename the folder. At this point, it appears to become locked and cannot be deleted.
2) Later I attempt to delete the folder using another File System task object. I get the error '[File System Task] Error: An error occurred with the following error message: "The process cannot access the file because it is being used by another process."'.
My package accesses the folder via a drive mapping. This seems to be part of the problem, as it's possible to delete the folder directly but not via the drive mapping. Even once the package completes it's still not possible to delete the folder in Windows Explorer via the drive mapping.
I've since rebooted my machine and re-created the network drive mapping and the problem has gone away.