Friday, March 30, 2012
moving and renaming a file
reads a text file and imports it into a table.
I would like to have it run automaticly.
For that to work correctly, it would need to check to see if the txt file is
there (the name is always teh same), if it is not there, then to quit. If
it is there, to read and import it as normal, then once completed, for it to
rename teh file and move it to another location on teh computer.
How do I do that?I'd use ActiveXScipt and the FileSystemObject. Here is some sample code:
Function Main()
dim fso, source, dest, oldFile
set fso = CreateObject("Scripting.FileSystemObject")
source = "\\myBox\FAAIVR\BENEFIT_GROUP_INFO.txt"
oldFile = replace(source, ".txt", "_" & replace(date - 7, "/","_") & ".txt")
if (fso.FileExists(source)) then
dest = replace(source, ".txt", "_" & replace(date, "/","_") & ".txt")
fso.MoveFile source, dest
end if
if (fso.FileExists(oldFile)) then
fso.DeleteFile (oldFile)
"Johnfli" wrote:
> I have a DTS package that I currently execute manually. This DTS package
> reads a text file and imports it into a table.
> I would like to have it run automaticly.
> For that to work correctly, it would need to check to see if the txt file is
> there (the name is always teh same), if it is not there, then to quit. If
> it is there, to read and import it as normal, then once completed, for it to
> rename teh file and move it to another location on teh computer.
> How do I do that?
>
>
Wednesday, March 28, 2012
Moving a log file while still "attached"
attached ?
Reason I am asking... I have run into cases where after detaching a
database, I was unable to re-attach it.No, you cant move the primary log file while your DB is up and running. You
can however create a second log file while the DB is still attached (and you
may be running out of space in the primary log file)
Would I create a second log - no unless absolutley necessary.
Next time you try moving the log file via detach and attach - make sure you
run dbcc checkdb before detaching - when no problems are reported - copy the
original log file to its new location - dont move it. This way in case attac
h
shouldnt work (e.g the log file got damaged on its way to the new volume) yo
u
can reattach with minimal further loss of time - to your original log file.
Hope this helped.
"Rob" wrote:
> Is there a way to move a log file to another drive while it is still
> attached ?
> Reason I am asking... I have run into cases where after detaching a
> database, I was unable to re-attach it.
>
>|||No, you cant move the primary log file while your DB is up and running. You
can however create a second log file while the DB is still attached (and you
may be running out of space in the primary log file)
Would I create a second log - no unless absolutley necessary.
Next time you try moving the log file via detach and attach - make sure you
run dbcc checkdb before detaching - when no problems are reported - copy the
original log file to its new location - dont move it. This way in case attac
h
shouldnt work (e.g the log file got damaged on its way to the new volume) yo
u
can reattach with minimal further loss of time - to your original log file.
Hope this helped.
"Rob" wrote:
> Is there a way to move a log file to another drive while it is still
> attached ?
> Reason I am asking... I have run into cases where after detaching a
> database, I was unable to re-attach it.
>
>|||Rob wrote:
> Is there a way to move a log file to another drive while it is still
> attached ?
> Reason I am asking... I have run into cases where after detaching a
> database, I was unable to re-attach it.
>
>
Instead of using attach, you can use RESTORE WITH MOVE. This is a much
safer way to do it since your source db will still be up and running and
operational. This means that if you backup for some reason doesnt work,
you can just make a new backup.
Regards
Steen Schlter Persson
DBA|||> Reason I am asking... I have run into cases where after detaching a database, I was unable
to
> re-attach it.
That should not happen. If you detach a database, then you should be able to
attach it, assuming you
*really* detached it first and you have all the files. If you fulfill those
criteria and still
cannot attach it, you have a bug in the product.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Rob" <rwchome@.comcast.net> wrote in message news:77-dncoBVcN_VhPZnZ2dnUVZ_qqdnZ2d@.comcast.c
om...
> Is there a way to move a log file to another drive while it is still attac
hed ?
> Reason I am asking... I have run into cases where after detaching a databa
se, I was unable to
> re-attach it.
>
>|||Rob wrote:
> Is there a way to move a log file to another drive while it is still
> attached ?
> Reason I am asking... I have run into cases where after detaching a
> database, I was unable to re-attach it.
>
>
Instead of using attach, you can use RESTORE WITH MOVE. This is a much
safer way to do it since your source db will still be up and running and
operational. This means that if you backup for some reason doesnt work,
you can just make a new backup.
Regards
Steen Schlter Persson
DBA|||> Reason I am asking... I have run into cases where after detaching a database, I was unable
to
> re-attach it.
That should not happen. If you detach a database, then you should be able to
attach it, assuming you
*really* detached it first and you have all the files. If you fulfill those
criteria and still
cannot attach it, you have a bug in the product.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Rob" <rwchome@.comcast.net> wrote in message news:77-dncoBVcN_VhPZnZ2dnUVZ_qqdnZ2d@.comcast.c
om...
> Is there a way to move a log file to another drive while it is still attac
hed ?
> Reason I am asking... I have run into cases where after detaching a databa
se, I was unable to
> re-attach it.
>
>
Moving a log file while still "attached"
attached ?
Reason I am asking... I have run into cases where after detaching a
database, I was unable to re-attach it.No, you cant move the primary log file while your DB is up and running. You
can however create a second log file while the DB is still attached (and you
may be running out of space in the primary log file)
Would I create a second log - no unless absolutley necessary.
Next time you try moving the log file via detach and attach - make sure you
run dbcc checkdb before detaching - when no problems are reported - copy the
original log file to its new location - dont move it. This way in case attach
shouldnt work (e.g the log file got damaged on its way to the new volume) you
can reattach with minimal further loss of time - to your original log file.
Hope this helped.
"Rob" wrote:
> Is there a way to move a log file to another drive while it is still
> attached ?
> Reason I am asking... I have run into cases where after detaching a
> database, I was unable to re-attach it.
>
>|||Rob wrote:
> Is there a way to move a log file to another drive while it is still
> attached ?
> Reason I am asking... I have run into cases where after detaching a
> database, I was unable to re-attach it.
>
>
Instead of using attach, you can use RESTORE WITH MOVE. This is a much
safer way to do it since your source db will still be up and running and
operational. This means that if you backup for some reason doesnt work,
you can just make a new backup.
--
Regards
Steen Schlüter Persson
DBA|||> Reason I am asking... I have run into cases where after detaching a database, I was unable to
> re-attach it.
That should not happen. If you detach a database, then you should be able to attach it, assuming you
*really* detached it first and you have all the files. If you fulfill those criteria and still
cannot attach it, you have a bug in the product.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Rob" <rwchome@.comcast.net> wrote in message news:77-dncoBVcN_VhPZnZ2dnUVZ_qqdnZ2d@.comcast.com...
> Is there a way to move a log file to another drive while it is still attached ?
> Reason I am asking... I have run into cases where after detaching a database, I was unable to
> re-attach it.
>
>sql
Monday, March 26, 2012
Moving a database from SQL Server to MSDE
I have created quite a large database project that the client now wants to
run locally for demo purposes.
What is the best (& easiest for non-programmer client) way to transport a
snapshot of this database from one to the other - with the data still
intact? The VS.Net tools appear to only move the structure and stored
procedures etc..
Thanks in adavance,
StuStu
I prefer BACKUP/RESTORE commands
"Stu Lock" <s.lock@.cergis.com> wrote in message
news:eCF$cGyyEHA.3336@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I have created quite a large database project that the client now wants to
> run locally for demo purposes.
> What is the best (& easiest for non-programmer client) way to transport a
> snapshot of this database from one to the other - with the data still
> intact? The VS.Net tools appear to only move the structure and stored
> procedures etc..
> Thanks in adavance,
> Stu
>|||How do you restore an SQL Server database to an MSDE instance that has no
database installed?
THnx.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23B1asKyyEHA.3840@.tk2msftngp13.phx.gbl...
> Stu
> I prefer BACKUP/RESTORE commands
>
>
> "Stu Lock" <s.lock@.cergis.com> wrote in message
> news:eCF$cGyyEHA.3336@.TK2MSFTNGP11.phx.gbl...
>> Hi,
>> I have created quite a large database project that the client now wants
>> to
>> run locally for demo purposes.
>> What is the best (& easiest for non-programmer client) way to transport a
>> snapshot of this database from one to the other - with the data still
>> intact? The VS.Net tools appear to only move the structure and stored
>> procedures etc..
>> Thanks in adavance,
>> Stu
>>
>|||"Stu Lock" <s.lock@.cergis.com> wrote in message
news:%23gQ5rBzyEHA.2540@.TK2MSFTNGP09.phx.gbl...
> How do you restore an SQL Server database to an MSDE instance that has no
> database installed?
>
Same way you'd restore it to any SQL Server. RESTORE DATABASE foo from
disk='\\foo\bar\baz.bak'
BOL will have more details.
> THnx.
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%23B1asKyyEHA.3840@.tk2msftngp13.phx.gbl...
> > Stu
> > I prefer BACKUP/RESTORE commands
> >
> >
> >
> >
> > "Stu Lock" <s.lock@.cergis.com> wrote in message
> > news:eCF$cGyyEHA.3336@.TK2MSFTNGP11.phx.gbl...
> >> Hi,
> >>
> >> I have created quite a large database project that the client now wants
> >> to
> >> run locally for demo purposes.
> >>
> >> What is the best (& easiest for non-programmer client) way to transport
a
> >> snapshot of this database from one to the other - with the data still
> >> intact? The VS.Net tools appear to only move the structure and stored
> >> procedures etc..
> >>
> >> Thanks in adavance,
> >>
> >> Stu
> >>
> >>
> >
> >
>|||Just be aware of the limitations of MSDE. Maximum DB size is 2GB.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:DVbmd.8248$qv5.8175@.twister.nyroc.rr.com...
> "Stu Lock" <s.lock@.cergis.com> wrote in message
> news:%23gQ5rBzyEHA.2540@.TK2MSFTNGP09.phx.gbl...
> > How do you restore an SQL Server database to an MSDE instance that has
no
> > database installed?
> >
> Same way you'd restore it to any SQL Server. RESTORE DATABASE foo from
> disk='\\foo\bar\baz.bak'
> BOL will have more details.
>
> > THnx.
> >
> >
> > "Uri Dimant" <urid@.iscar.co.il> wrote in message
> > news:%23B1asKyyEHA.3840@.tk2msftngp13.phx.gbl...
> > > Stu
> > > I prefer BACKUP/RESTORE commands
> > >
> > >
> > >
> > >
> > > "Stu Lock" <s.lock@.cergis.com> wrote in message
> > > news:eCF$cGyyEHA.3336@.TK2MSFTNGP11.phx.gbl...
> > >> Hi,
> > >>
> > >> I have created quite a large database project that the client now
wants
> > >> to
> > >> run locally for demo purposes.
> > >>
> > >> What is the best (& easiest for non-programmer client) way to
transport
> a
> > >> snapshot of this database from one to the other - with the data still
> > >> intact? The VS.Net tools appear to only move the structure and stored
> > >> procedures etc..
> > >>
> > >> Thanks in adavance,
> > >>
> > >> Stu
> > >>
> > >>
> > >
> > >
> >
> >
>
Moving a database from one machine to another and the lack of speed
We have a procedure that takes12 minutes to run on the first server but
that same procedure now takes 3 hours to run on the second server using the
same data. Does anyone have any suggestions why this is happening and how
to make the procedure faster on the second server
Thanks in advance.
Jeff Magouirk"Jeff Magouirk" <magouirkj@.njc.org> wrote in message
news:113bhrh7krjtjad@.corp.supernews.com...
> Dear All,
> We have a procedure that takes12 minutes to run on the first server but
> that same procedure now takes 3 hours to run on the second server using
> the same data. Does anyone have any suggestions why this is happening and
> how to make the procedure faster on the second server
> Thanks in advance.
> Jeff Magouirk
>
No idea - the usual advice if you see something like that is to a) update
statistics, and b) use Profiler to identify what's taking so much time. You
can also capture the execution plan in Profiler (or use Query Analyzer,
which is a bit more user-friendly), and compare it against the plan on the
original server.
If that doesn't help, you'll need to give more details about your
environment - are they the same MSSQL version? The same hardware? Do you
have the same database schema (including indexes etc.)? Are the database
files exactly the same size? Are they using the same recovery model? Is the
data the same (or nearly so)? Is everything slow, or only certain
procedures? Etc.
Simon
moving a database from 2005 to 2000
but wondering if you can run scripts in sql 2000 created in 2005 to recreate
the database?
thanks
--
Paul G
Software engineer.Yes. When you generate the script set the "Script for Server Version"
option to SQL Server 2000.
Roy Harvey
Beacon Falls, CT
On Fri, 25 Apr 2008 15:13:00 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi I have heard that you can not restore a 2000 SQL database from a 2005 file
>but wondering if you can run scripts in sql 2000 created in 2005 to recreate
>the database?
>thanks|||ok found the script type selection option! thanks.
--
Paul G
Software engineer.
"Roy Harvey (SQL Server MVP)" wrote:
> Yes. When you generate the script set the "Script for Server Version"
> option to SQL Server 2000.
> Roy Harvey
> Beacon Falls, CT
> On Fri, 25 Apr 2008 15:13:00 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >Hi I have heard that you can not restore a 2000 SQL database from a 2005 file
> >but wondering if you can run scripts in sql 2000 created in 2005 to recreate
> >the database?
> >thanks
>sql
Monday, March 19, 2012
move table data from one filegroup to another
i wanna move table data from one filegroup to another , i
can do it in Enterprise Manager . can i use script to run
it in SQL Analyzer ?
Your answer is highly apprieated .(Re)-create a/the clustered index on the table.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"rainbow" <genghj@.routon.com> wrote in message news:02f101c3871c$05237630$a001280a@.phx.gbl...
> hi,
> i wanna move table data from one filegroup to another , i
> can do it in Enterprise Manager . can i use script to run
> it in SQL Analyzer ?
> Your answer is highly apprieated .|||What if they dont have a clustered index ..a heap or what if they just have
only non clustered indexes.
"Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
wrote in message news:OUkjT5xhDHA.1952@.TK2MSFTNGP10.phx.gbl...
> (Re)-create a/the clustered index on the table.
> --
> Tibor Karaszi, SQL Server MVP
> Archive at: http://groups.google.com/groups?oi=djq&as
ugroup=microsoft.public.sqlserver
>
> "rainbow" <genghj@.routon.com> wrote in message
news:02f101c3871c$05237630$a001280a@.phx.gbl...
> > hi,
> > i wanna move table data from one filegroup to another , i
> > can do it in Enterprise Manager . can i use script to run
> > it in SQL Analyzer ?
> > Your answer is highly apprieated .
>|||That's why Tibor put (RE)Create
It means recreate the clustered index if you have one, or create one if you
don't. You can drop the clustered index afterward if you really don't want
to keep it, but you should really have a good reason NOT to have a clustered
index on a table.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:u6a#ep3hDHA.1200@.TK2MSFTNGP09.phx.gbl...
> What if they dont have a clustered index ..a heap or what if they just
have
> only non clustered indexes.
> "Tibor Karaszi"
<tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
> wrote in message news:OUkjT5xhDHA.1952@.TK2MSFTNGP10.phx.gbl...
> > (Re)-create a/the clustered index on the table.
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at: http://groups.google.com/groups?oi=djq&as
> ugroup=microsoft.public.sqlserver
> >
> >
> > "rainbow" <genghj@.routon.com> wrote in message
> news:02f101c3871c$05237630$a001280a@.phx.gbl...
> > > hi,
> > > i wanna move table data from one filegroup to another , i
> > > can do it in Enterprise Manager . can i use script to run
> > > it in SQL Analyzer ?
> > > Your answer is highly apprieated .
> >
> >
>
Monday, February 20, 2012
MS Reporting, Oracle
when I try to run a select-statement to an oracle database (10.1.03) with a
parameter from the SQL-area in MS Reporting I get a message like:
'The provider can not determine parameter information and setParameterInfo'
is not called' (or similar, the original message is in german).
The select statement is like:
SELECT LOT, MACHINENUM, ARTICLE10, ARTICLEVARIANT, MEAS_MODE,
TOTALCOUNT, PDATE_START, PDATE_END, GRINDCLASS, GRINDLIMIT
FROM TBLLOT
WHERE (MACHINENUM = @.machineNum)
ORDER BY LOT
There is no problem without the parameter, and there is no problem with the
parameter when I use a SQLServer DB.
Can someone help?
Thanks
Ulf
@.param is SQL Server specific, from BOL
Support for parameters in Oracle depends on the data provider that is used
to connect to the Oracle database. If your query contains named parameters
(for example, SELECT * FROM <table> WHERE <column name> = :ParameterName)
then you must use the Oracle data processing extension. If your query
contains unnamed parameters (for example, SELECT * FROM <table> WHERE
<column name> = ?), then you must use the OLE DB data processing extension
and select Microsoft OLE DB Provider for Oracle as a data provider
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
"Ulf" <Ulf@.discussions.microsoft.com> wrote in message
news:AFA90B76-8342-4EBA-AF07-BA5B01A78715@.microsoft.com...
> Hi,
> when I try to run a select-statement to an oracle database (10.1.03) with
> a
> parameter from the SQL-area in MS Reporting I get a message like:
> 'The provider can not determine parameter information and
> setParameterInfo'
> is not called' (or similar, the original message is in german).
> The select statement is like:
> SELECT LOT, MACHINENUM, ARTICLE10, ARTICLEVARIANT, MEAS_MODE,
> TOTALCOUNT, PDATE_START, PDATE_END, GRINDCLASS, GRINDLIMIT
> FROM TBLLOT
> WHERE (MACHINENUM = @.machineNum)
> ORDER BY LOT
> There is no problem without the parameter, and there is no problem with
> the
> parameter when I use a SQLServer DB.
> Can someone help?
> Thanks
> Ulf
|||Hi Jasper,
thank you for your answer. But this answer does not solve my problem. It is
simply not possible to use a syntax like :parameter in MS Reporting, and I
have had no success with unnamed parameters. It also seems like a MS
Reporting problem (or bug). I expect that MS Reporting will replace my
parameter (@.machineNum) with the value before sendeing the statement to
Oracle but may be I am wrong in this point.
I need a method to send a select-statement to Oracle with consideartion of
a user input. May be stored procedures will help but I prefer not to use
them.
ulf
"Ulf" wrote:
> Hi,
> when I try to run a select-statement to an oracle database (10.1.03) with a
> parameter from the SQL-area in MS Reporting I get a message like:
> 'The provider can not determine parameter information and setParameterInfo'
> is not called' (or similar, the original message is in german).
> The select statement is like:
> SELECT LOT, MACHINENUM, ARTICLE10, ARTICLEVARIANT, MEAS_MODE,
> TOTALCOUNT, PDATE_START, PDATE_END, GRINDCLASS, GRINDLIMIT
> FROM TBLLOT
> WHERE (MACHINENUM = @.machineNum)
> ORDER BY LOT
> There is no problem without the parameter, and there is no problem with the
> parameter when I use a SQLServer DB.
> Can someone help?
> Thanks
> Ulf
|||Hi Jasper,
thank you for your answer. But this answer does not solve my problem. It is
simply not possible to use a syntax like :parameter in MS Reporting, and I
have had no success with unnamed parameters. It also seems like a MS
Reporting problem (or bug). I expect that MS Reporting will replace my
parameter (@.machineNum) with the value before sendeing the statement to
Oracle but may be I am wrong in this point.
I need a method to send a select-statement to Oracle with consideartion of
a user input. May be stored procedures will help but I prefer not to use
them.
ulf
"Jasper Smith" wrote:
> @.param is SQL Server specific, from BOL
> Support for parameters in Oracle depends on the data provider that is used
> to connect to the Oracle database. If your query contains named parameters
> (for example, SELECT * FROM <table> WHERE <column name> = :ParameterName)
> then you must use the Oracle data processing extension. If your query
> contains unnamed parameters (for example, SELECT * FROM <table> WHERE
> <column name> = ?), then you must use the OLE DB data processing extension
> and select Microsoft OLE DB Provider for Oracle as a data provider
> --
> HTH,
> Jasper Smith (SQL Server MVP)
> http://www.sqldbatips.com
>
> "Ulf" <Ulf@.discussions.microsoft.com> wrote in message
> news:AFA90B76-8342-4EBA-AF07-BA5B01A78715@.microsoft.com...
>
>