Showing posts with label current. Show all posts
Showing posts with label current. Show all posts

Friday, March 30, 2012

renaming domain

We have a small site where we want to rename the domain and bring it into
our domain.
current names are as
domainx.local -holds SQL server cluster
domainx.net -main domain
we want to bring domainx.local into the domainx.net AD.
will will rename and migrate. Are there any tools for SQL2005?
we were planning on using the microsoft domain rename tool and ADMT3.
Any other issues with SQL?
Regards
CC
SQL itself doesn't really care what domain it is in, as long as all of the
resources and servers it has to access are still accessible the way they
were before. The only thing you will have to update is the windows service
accounts if any of them are from AD and not the local machine. Will it be
renamed or are you moving to a new domain while the old domain remains up
for a short period of time? If the latter I would recommend setting up a
trust and switching the accounts, or understanding that you might have blips
in uptime/availability.
"Ned" <Cal@.obded.org> wrote in message
news:%231UNGh2ZIHA.2000@.TK2MSFTNGP05.phx.gbl...
> We have a small site where we want to rename the domain and bring it into
> our domain.
> current names are as
> domainx.local -holds SQL server cluster
> domainx.net -main domain
> we want to bring domainx.local into the domainx.net AD.
> will will rename and migrate. Are there any tools for SQL2005?
> we were planning on using the microsoft domain rename tool and ADMT3.
> Any other issues with SQL?
> Regards
> CC
>
|||Hi
I assume that the machine names for the SQL Servers are not changing?
If you have granted logins to domain accounts or groups then you may need to
change them see http://support.microsoft.com/kb/298897/
John
"Ned" wrote:

> We have a small site where we want to rename the domain and bring it into
> our domain.
> current names are as
> domainx.local -holds SQL server cluster
> domainx.net -main domain
> we want to bring domainx.local into the domainx.net AD.
> will will rename and migrate. Are there any tools for SQL2005?
> we were planning on using the microsoft domain rename tool and ADMT3.
> Any other issues with SQL?
> Regards
> CC
>
>

renaming domain

We have a small site where we want to rename the domain and bring it into
our domain.
current names are as
domainx.local -holds SQL server cluster
domainx.net -main domain
we want to bring domainx.local into the domainx.net AD.
will will rename and migrate. Are there any tools for SQL2005?
we were planning on using the microsoft domain rename tool and ADMT3.
Any other issues with SQL?
Regards
CCSQL itself doesn't really care what domain it is in, as long as all of the
resources and servers it has to access are still accessible the way they
were before. The only thing you will have to update is the windows service
accounts if any of them are from AD and not the local machine. Will it be
renamed or are you moving to a new domain while the old domain remains up
for a short period of time? If the latter I would recommend setting up a
trust and switching the accounts, or understanding that you might have blips
in uptime/availability.
"Ned" <Cal@.obded.org> wrote in message
news:%231UNGh2ZIHA.2000@.TK2MSFTNGP05.phx.gbl...
> We have a small site where we want to rename the domain and bring it into
> our domain.
> current names are as
> domainx.local -holds SQL server cluster
> domainx.net -main domain
> we want to bring domainx.local into the domainx.net AD.
> will will rename and migrate. Are there any tools for SQL2005?
> we were planning on using the microsoft domain rename tool and ADMT3.
> Any other issues with SQL?
> Regards
> CC
>|||Hi
I assume that the machine names for the SQL Servers are not changing?
If you have granted logins to domain accounts or groups then you may need to
change them see http://support.microsoft.com/kb/298897/
John
"Ned" wrote:
> We have a small site where we want to rename the domain and bring it into
> our domain.
> current names are as
> domainx.local -holds SQL server cluster
> domainx.net -main domain
> we want to bring domainx.local into the domainx.net AD.
> will will rename and migrate. Are there any tools for SQL2005?
> we were planning on using the microsoft domain rename tool and ADMT3.
> Any other issues with SQL?
> Regards
> CC
>
>

Renaming database after log shipping.

In order to move from one data center to another, I am planning to use log shipping.
Lets say,

Current Data center - DC1
Current Server- S1
Current Database- DB1

New Data Center -DC2
New Server -S2

Now, on the New Server S2, I already restored DB1 as DB1 for QA testing. QA has to do some testing before we move from DC1 to DC2. In the mean time, I need to start log shipping from S1 to S2, so that we can fail-over to S2. Now since DB1 database is already present on S2, I can not use the same name. I will have to use some other name (say DB1_New).
I can not wait for QA to finish their testing. I have to start log shipping before that. When QA is done, I will delete the DB1.

So for this log shipping, -

Primary - S1- DB1
Secondary - S2 DB1_New

So when we fail-over, we will have the database name as DB1_New. But all the apps use the name DB1. So I will have to rename the database as DB1.

So want to know, will this renaming the database (DB1_New to DB1) cause any issues?

Anyone had similar experience?

Thanks

Generally, you would be okay - some of that depends on how you have things configured, how long you are going to ship the logs before failing over to the other site, if logins/users have changed. You would want to consider what jobs you have running on the server, how this impacts your fail over plans and backups, anything pointing to the DB_new database name would need to be evaluated, etc. After the fail over and rename, you'd probably want to do a full backup of your databases, make sure the users are all intact, etc.

-Sue

|||

hi,

even if u have the same dbs in both source and detination prior to configuring log shipping, u need not create a new db in secondary instead u can drop the db in secondary......and while configuring log shipping u have the option to create the db @.destination if the db doesnt exist there already........if the failover is done properly all users from primary will be able to connect.....ensure that wherever u specified the db1 name in application change it to db1_new in your scenario........

Renaming an Access table in an SSIS package

My current project requires me to both rename the MDB file for an Access database and rename the table it contains. The Access files comes in with random names, each containing one table with a specific name. Based on the table name it contains, I rename both the file and the interior table to a standard name which a later package in the process references.

A foreach container loops through all the mdb files in the applicable directory, containing a script task and a file system task. The script task uses GetOleDbSchemaTable to extract the table name, then loops through an array of table names from the client's configuration, comparing it to a similar array of constant names and getting the matching one. The file system task then uses that found name (or the original table name if a conversion is not found) to rename the file to match that standard name. So far, so good.

Now I have to rename the table within the file as well. All of the examples of code I'm finding on the 'net refernce ADOX, but I haven't been able to figure out how to use that in a script task, assuming that's what I want to do in the first place.

Anyone have any experience with doing things like this?

Approach 1Tongue Tiedelect into a new table then drop the old table.

Approach 2: Keep the old "standard" import database and delete from the standard table, then select into it from the new database (that is, instead of renaming the existing object, just select into the desired destination object) then delete/archive the random-named database.

In the past I would have used DAO and the tabledefs collection therein to rename the table, but that is rather old-school these days. No guarantee that it would work.

|||

Thanks, Dylan. I may give the DAO a try just for giggles, because the alternative is (for now) each client having their own copy of a relatively complex package.

Monday, March 26, 2012

Rename SQL Server Virtual name in 2003 Cluster

Is it possible to change the current SQL virtual host name in Windows 2003?
and How?
I tried it by right click on the SQL Network name resource -> properties ->
parameters -> change the name. Then search the registry and change it to a
new name and reboot the node. It works but is there an easy way and is what
I did a safe procedure.
Thanks
Ayad
You sure can, see http://support.microsoft.com/?id=307336 for details
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Ayad" <ashammout1@.hotmail.com> wrote in message
news:%239vieFHsEHA.760@.tk2msftngp13.phx.gbl...
> Is it possible to change the current SQL virtual host name in Windows
> 2003?
> and How?
> I tried it by right click on the SQL Network name resource ->
> properties ->
> parameters -> change the name. Then search the registry and change it to a
> new name and reboot the node. It works but is there an easy way and is
> what
> I did a safe procedure.
> Thanks
> Ayad
>
|||Thanks Rod. But I don't want to un-install and re-install SQL to change the
name.
Ayad
"Rodney R. Fournier [MVP]" <rod@.die.spam.die.nw-america.com> wrote in
message news:%23X1xRMIsEHA.2732@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> You sure can, see http://support.microsoft.com/?id=307336 for details
> Cheers,
> Rod
> MVP - Windows Server - Clustering
> http://www.nw-america.com - Clustering
> http://msmvps.com/clustering - Blog
> "Ayad" <ashammout1@.hotmail.com> wrote in message
> news:%239vieFHsEHA.760@.tk2msftngp13.phx.gbl...
a
>
|||Ok, that's cool. You know you don't have to reinstall. It's right click
rename, then sp_dropserver old_virtualservername
go, sp_addserver new_virtualservername, local go, etc.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Ayad" <ashammout1@.hotmail.com> wrote in message
news:eEPiKeJsEHA.2904@.TK2MSFTNGP15.phx.gbl...
> Thanks Rod. But I don't want to un-install and re-install SQL to change
> the
> name.
> Ayad
> "Rodney R. Fournier [MVP]" <rod@.die.spam.die.nw-america.com> wrote in
> message news:%23X1xRMIsEHA.2732@.TK2MSFTNGP09.phx.gbl...
> a
>
|||Hi
Not much choice. Clustering is one of those technologies that you follow the
KB articles exactly otherwise the whole thing comes apart and you end up
re-installing everything.
Sorry.
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/
"Ayad" <ashammout1@.hotmail.com> wrote in message
news:eEPiKeJsEHA.2904@.TK2MSFTNGP15.phx.gbl...
> Thanks Rod. But I don't want to un-install and re-install SQL to change
the[vbcol=seagreen]
> name.
> Ayad
> "Rodney R. Fournier [MVP]" <rod@.die.spam.die.nw-america.com> wrote in
> message news:%23X1xRMIsEHA.2732@.TK2MSFTNGP09.phx.gbl...
to
> a
>
|||I agree with Mike. The ONLY SUPPORTED way to rename a virtual SQL name is to uninstall and reinstall as documented in Microsoft Knowledge Base article
INF: How to Change a Clustered SQL Server Network Name
http://support.microsoft.com/?kbid=307336
This article has the following important NOTE
"Cluster Administrator provides a method to rename cluster resources. To do this, right-click the resource in Cluster Administrator and click Rename. However, if you
rename the SQL Server Network Name resource, a variety of situations could occur, the most critical being that the SQL Server virtual server instance may no longer come
online. "
Best Regards,
Uttam Parui
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their Microsoft software to better protect against viruses and security vulnerabilities. The easiest way
to do this is to visit the following websites: http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx

Rename server names in Enterprise Manager?

Hi there.

Sorry 'bout my bad english.
Is there any possibility, to change the current server name from the stuctureview in the Enterprise Manger. I'm registering a lot of online-servers from my customers. The remote servername is fixed of course, but I want to change it local, to explain it a little bit better
(e.g. "W2KSQLSRV" -> "CustomerXY")

Can someone give me a hint, please?

Thanx.Not mentioned the version of SQL server used>

If its SQL 2K then you can use SP_DROPSERVER & SP_ADDSERVER which will take affect at the restart of SQL services.

If its version 7 then you've to run the setup again to take new changes affected.

Refer to books online about Renaming Servers topic.|||Originally posted by LuckyLights
Hi there.

Sorry 'bout my bad english.
Is there any possibility, to change the current server name from the stuctureview in the Enterprise Manger. I'm registering a lot of online-servers from my customers. The remote servername is fixed of course, but I want to change it local, to explain it a little bit better
(e.g. "W2KSQLSRV" -> "CustomerXY")

Can someone give me a hint, please?

Thanx. It sounds to me like you want to register a server, but have a completely different name show up on the screen in the Server collection. IF I understood what you wanted correctly, according to How to register a server (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/howtosql/ht_servpem_7jua.asp), that can't be done.

-PatP

Friday, March 23, 2012

Rename File

I have a text file (*.txt) created from a DTS Package. I need to change the
file name after it is created to add the current timestamp in the file name
(i.e. date and time).
Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.txt
'
Is there a way I can do this ?. T-SQL syntax from DTS package ?
Thanks for any help.You can do it before creating it.
How can I change the filename for a text file connection?
http://www.sqldts.com/default.aspx?200
AMB
"DXC" wrote:

> I have a text file (*.txt) created from a DTS Package. I need to change th
e
> file name after it is created to add the current timestamp in the file nam
e
> (i.e. date and time).
> Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.t
xt'
> Is there a way I can do this ?. T-SQL syntax from DTS package ?
> Thanks for any help.|||Thanks for the info but I am not a VB or ActixeX expert. Any idea on the
usage of the script '
Thanks.
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> You can do it before creating it.
> How can I change the filename for a text file connection?
> http://www.sqldts.com/default.aspx?200
>
> AMB
> "DXC" wrote:
>|||you might be able to use xp_cmdshell and pass in the rename of the file just
like you would from dos.
so you already know the path the the file and the name of the file. you just
need to create a varchar with the correct formatted date/time in the name
and pass the entire rename/move command to xp_cmdshell just like from dos.
that's really about the easiest way to do this imo.
DXC wrote:

> I have a text file (*.txt) created from a DTS Package. I need to change
> the file name after it is created to add the current timestamp in the file
> name (i.e. date and time).
> Ex: The filename is 'Myfile.txt' and I need to make it
> 'Myfile0506051022.txt'
> Is there a way I can do this ?. T-SQL syntax from DTS package ?
> Thanks for any help.
new|||Thanks. I am already using something like this:
declare @.rename varchar(255)
select @.rename =
'ren "\\172.22.16.12\D$\Program Files\Microsoft SQL
Server\MSSQL\Backup\MYDB1\MYDB1*.BAK" '
+ 'MYDB1'
+ '.BAK'
exec master..xp_cmdshell @.rename
to get rid of the timestamp but I don't know how to include the timestamp in
an existin file. I tried something like this but it did not work:
declare @.rename varchar(255)
declare @.filename datetime
Set @.filename = (LEFT(GETDATE(), 12) )
select @.rename =
'ren "\\172.22.16.12\D$\Program Files\Microsoft SQL
Server\MSSQL\Backup\MYDB1\MYDB1*.BAK" '
+ 'MYDB1'
+ '@.filename'
+ '.BAK'
exec master..xp_cmdshell @.rename
Thanks..........
"beginthreadex" wrote:

> you might be able to use xp_cmdshell and pass in the rename of the file ju
st
> like you would from dos.
> so you already know the path the the file and the name of the file. you ju
st
> need to create a varchar with the correct formatted date/time in the name
> and pass the entire rename/move command to xp_cmdshell just like from dos.
> that's really about the easiest way to do this imo.
>
> DXC wrote:
>
> --
> new
>|||'***************************************
*******************************
' Visual Basic ActiveX Script
' Author: Keith Kosmicki
' Date 10 May 2005
' Purpose: Change file name after its been exported to Date Time Stamp
'***************************************
*********************************
Function Main()
Main = DTSTaskExecResult_Success
End Function
Dim StrAccessSrc, StrNew, fso, sf, systime
StrAccessSrc = "\\Web1\ftp\Prime Vendor\test1"
Set fso = CreateObject("Scripting.FileSystemObject")
set saf = fso.GetFile(StrAccessSrc)
systime=now()
'Call Comment(ssf) 'ADD A TIMESTAMP AT THE END OF THE FILE SPECIFIED
Call RenameSFile(saf) 'RENAME THE SOURCE FILE WITH THE DATE FORMAT OF YYYYMM
DDHHMMSS
'Sub Comment(af)
' Dim tsa
' Const ForAppending = 8
' set tsa=saf.OpenAsTextStream(ForAppending)
' tsa.writeline cstr(systime)
' tsa.close
'End Sub
Sub RenameSFile(sf)
StrNew=sf.ParentFolder &"\Customer-" & cstr(year(systime)) & cstr(month(syst
ime)) & cstr(day(systime)) & cstr(hour(systime)) & cstr(minute(systime)) & c
str(second(systime))
sf.move StrNew
End Sub
Best,
Kos
User submitted from AEWNET (http://www.aewnet.com/)|||'***************************************
*******************************
' Visual Basic ActiveX Script
' Author: Keith Kosmicki
' Date 10 May 2005
' Purpose: Change file name after its been exported to Date Time Stamp
'***************************************
*********************************
Function Main()
Main = DTSTaskExecResult_Success
End Function
Dim StrAccessSrc, StrNew, fso, sf, systime
StrAccessSrc = "\\Web1\ftp\Prime Vendor\test1"
Set fso = CreateObject("Scripting.FileSystemObject")
set saf = fso.GetFile(StrAccessSrc)
systime=now()
'Call Comment(ssf) 'ADD A TIMESTAMP AT THE END OF THE FILE SPECIFIED
Call RenameSFile(saf) 'RENAME THE SOURCE FILE WITH THE DATE FORMAT OF YYYYMM
DDHHMMSS
'Sub Comment(af)
' Dim tsa
' Const ForAppending = 8
' set tsa=saf.OpenAsTextStream(ForAppending)
' tsa.writeline cstr(systime)
' tsa.close
'End Sub
Sub RenameSFile(sf)
StrNew=sf.ParentFolder &"\Customer-" & cstr(year(systime)) & cstr(month(syst
ime)) & cstr(day(systime)) & cstr(hour(systime)) & cstr(minute(systime)) & c
str(second(systime))
sf.move StrNew
End Sub
Best,
Kos
User submitted from AEWNET (http://www.aewnet.com/)

Rename File

I have a text file (*.txt) created from a DTS Package. I need to change the
file name after it is created to add the current timestamp in the file name
(i.e. date and time).
Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.txt'
Is there a way I can do this ?. T-SQL syntax from DTS package ?
Thanks for any help.
You can do it before creating it.
How can I change the filename for a text file connection?
http://www.sqldts.com/default.aspx?200
AMB
"DXC" wrote:

> I have a text file (*.txt) created from a DTS Package. I need to change the
> file name after it is created to add the current timestamp in the file name
> (i.e. date and time).
> Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.txt'
> Is there a way I can do this ?. T-SQL syntax from DTS package ?
> Thanks for any help.
|||Thanks for the info but I am not a VB or ActixeX expert. Any idea on the
usage of the script ?
Thanks.
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> You can do it before creating it.
> How can I change the filename for a text file connection?
> http://www.sqldts.com/default.aspx?200
>
> AMB
> "DXC" wrote:
|||you might be able to use xp_cmdshell and pass in the rename of the file just
like you would from dos.
so you already know the path the the file and the name of the file. you just
need to create a varchar with the correct formatted date/time in the name
and pass the entire rename/move command to xp_cmdshell just like from dos.
that's really about the easiest way to do this imo.
DXC wrote:

> I have a text file (*.txt) created from a DTS Package. I need to change
> the file name after it is created to add the current timestamp in the file
> name (i.e. date and time).
> Ex: The filename is 'Myfile.txt' and I need to make it
> 'Myfile0506051022.txt'
> Is there a way I can do this ?. T-SQL syntax from DTS package ?
> Thanks for any help.
new
|||Thanks. I am already using something like this:
declare @.rename varchar(255)
select @.rename =
'ren "\\172.22.16.12\D$\Program Files\Microsoft SQL
Server\MSSQL\Backup\MYDB1\MYDB1*.BAK" '
+ 'MYDB1'
+ '.BAK'
exec master..xp_cmdshell @.rename
to get rid of the timestamp but I don't know how to include the timestamp in
an existin file. I tried something like this but it did not work:
declare @.rename varchar(255)
declare @.filename datetime
Set @.filename = (LEFT(GETDATE(), 12) )
select @.rename =
'ren "\\172.22.16.12\D$\Program Files\Microsoft SQL
Server\MSSQL\Backup\MYDB1\MYDB1*.BAK" '
+ 'MYDB1'
+ '@.filename'
+ '.BAK'
exec master..xp_cmdshell @.rename
Thanks..........
"beginthreadex" wrote:

> you might be able to use xp_cmdshell and pass in the rename of the file just
> like you would from dos.
> so you already know the path the the file and the name of the file. you just
> need to create a varchar with the correct formatted date/time in the name
> and pass the entire rename/move command to xp_cmdshell just like from dos.
> that's really about the easiest way to do this imo.
>
> DXC wrote:
>
> --
> new
>
|||'************************************************* *********************
' Visual Basic ActiveX Script
' Author: Keith Kosmicki
' Date 10 May 2005
' Purpose: Change file name after its been exported to Date Time Stamp
'************************************************* ***********************
Function Main()
Main = DTSTaskExecResult_Success
End Function
Dim StrAccessSrc, StrNew, fso, sf, systime
StrAccessSrc="\\Web1\ftp\Prime Vendor\test1"
Set fso = CreateObject("Scripting.FileSystemObject")
set saf=fso.GetFile(StrAccessSrc)
systime=now()
'Call Comment(ssf) 'ADD A TIMESTAMP AT THE END OF THE FILE SPECIFIED
Call RenameSFile(saf) 'RENAME THE SOURCE FILE WITH THE DATE FORMAT OF YYYYMMDDHHMMSS
'Sub Comment(af)
'Dim tsa
'Const ForAppending = 8
'set tsa=saf.OpenAsTextStream(ForAppending)
'tsa.writeline cstr(systime)
'tsa.close
'End Sub
Sub RenameSFile(sf)
StrNew=sf.ParentFolder &"\Customer-" & cstr(year(systime)) & cstr(month(systime)) & cstr(day(systime)) & cstr(hour(systime)) & cstr(minute(systime)) & cstr(second(systime))
sf.move StrNew
End Sub
Best,
Kos
User submitted from AEWNET (http://www.aewnet.com/)
|||'************************************************* *********************
' Visual Basic ActiveX Script
' Author: Keith Kosmicki
' Date 10 May 2005
' Purpose: Change file name after its been exported to Date Time Stamp
'************************************************* ***********************
Function Main()
Main = DTSTaskExecResult_Success
End Function
Dim StrAccessSrc, StrNew, fso, sf, systime
StrAccessSrc="\\Web1\ftp\Prime Vendor\test1"
Set fso = CreateObject("Scripting.FileSystemObject")
set saf=fso.GetFile(StrAccessSrc)
systime=now()
'Call Comment(ssf) 'ADD A TIMESTAMP AT THE END OF THE FILE SPECIFIED
Call RenameSFile(saf) 'RENAME THE SOURCE FILE WITH THE DATE FORMAT OF YYYYMMDDHHMMSS
'Sub Comment(af)
'Dim tsa
'Const ForAppending = 8
'set tsa=saf.OpenAsTextStream(ForAppending)
'tsa.writeline cstr(systime)
'tsa.close
'End Sub
Sub RenameSFile(sf)
StrNew=sf.ParentFolder &"\Customer-" & cstr(year(systime)) & cstr(month(systime)) & cstr(day(systime)) & cstr(hour(systime)) & cstr(minute(systime)) & cstr(second(systime))
sf.move StrNew
End Sub
Best,
Kos
User submitted from AEWNET (http://www.aewnet.com/)

Rename File

I have a text file (*.txt) created from a DTS Package. I need to change the
file name after it is created to add the current timestamp in the file name
(i.e. date and time).
Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.txt'
Is there a way I can do this ?. T-SQL syntax from DTS package ?
Thanks for any help.You can do it before creating it.
How can I change the filename for a text file connection?
http://www.sqldts.com/default.aspx?200
AMB
"DXC" wrote:
> I have a text file (*.txt) created from a DTS Package. I need to change the
> file name after it is created to add the current timestamp in the file name
> (i.e. date and time).
> Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.txt'
> Is there a way I can do this ?. T-SQL syntax from DTS package ?
> Thanks for any help.|||Thanks for the info but I am not a VB or ActixeX expert. Any idea on the
usage of the script '
Thanks.
"Alejandro Mesa" wrote:
> You can do it before creating it.
> How can I change the filename for a text file connection?
> http://www.sqldts.com/default.aspx?200
>
> AMB
> "DXC" wrote:
> > I have a text file (*.txt) created from a DTS Package. I need to change the
> > file name after it is created to add the current timestamp in the file name
> > (i.e. date and time).
> > Ex: The filename is 'Myfile.txt' and I need to make it 'Myfile0506051022.txt'
> >
> > Is there a way I can do this ?. T-SQL syntax from DTS package ?
> >
> > Thanks for any help.|||you might be able to use xp_cmdshell and pass in the rename of the file just
like you would from dos.
so you already know the path the the file and the name of the file. you just
need to create a varchar with the correct formatted date/time in the name
and pass the entire rename/move command to xp_cmdshell just like from dos.
that's really about the easiest way to do this imo.
DXC wrote:
> I have a text file (*.txt) created from a DTS Package. I need to change
> the file name after it is created to add the current timestamp in the file
> name (i.e. date and time).
> Ex: The filename is 'Myfile.txt' and I need to make it
> 'Myfile0506051022.txt'
> Is there a way I can do this ?. T-SQL syntax from DTS package ?
> Thanks for any help.
--
new|||Thanks. I am already using something like this:
declare @.rename varchar(255)
select @.rename ='ren "\\172.22.16.12\D$\Program Files\Microsoft SQL
Server\MSSQL\Backup\MYDB1\MYDB1*.BAK" '
+ 'MYDB1'
+ '.BAK'
exec master..xp_cmdshell @.rename
to get rid of the timestamp but I don't know how to include the timestamp in
an existin file. I tried something like this but it did not work:
declare @.rename varchar(255)
declare @.filename datetime
Set @.filename = (LEFT(GETDATE(), 12) )
select @.rename ='ren "\\172.22.16.12\D$\Program Files\Microsoft SQL
Server\MSSQL\Backup\MYDB1\MYDB1*.BAK" '
+ 'MYDB1'
+ '@.filename'
+ '.BAK'
exec master..xp_cmdshell @.rename
Thanks..........
"beginthreadex" wrote:
> you might be able to use xp_cmdshell and pass in the rename of the file just
> like you would from dos.
> so you already know the path the the file and the name of the file. you just
> need to create a varchar with the correct formatted date/time in the name
> and pass the entire rename/move command to xp_cmdshell just like from dos.
> that's really about the easiest way to do this imo.
>
> DXC wrote:
> > I have a text file (*.txt) created from a DTS Package. I need to change
> > the file name after it is created to add the current timestamp in the file
> > name (i.e. date and time).
> > Ex: The filename is 'Myfile.txt' and I need to make it
> > 'Myfile0506051022.txt'
> >
> > Is there a way I can do this ?. T-SQL syntax from DTS package ?
> >
> > Thanks for any help.
> --
> new
>|||'**********************************************************************
' Visual Basic ActiveX Script
' Author: Keith Kosmicki
' Date 10 May 2005
' Purpose: Change file name after its been exported to Date Time Stamp
'************************************************************************
Function Main()
Main = DTSTaskExecResult_Success
End Function
Dim StrAccessSrc, StrNew, fso, sf, systime
StrAccessSrc = "\\Web1\ftp\Prime Vendor\test1"
Set fso = CreateObject("Scripting.FileSystemObject")
set saf = fso.GetFile(StrAccessSrc)
systime=now()
'Call Comment(ssf) 'ADD A TIMESTAMP AT THE END OF THE FILE SPECIFIED
Call RenameSFile(saf) 'RENAME THE SOURCE FILE WITH THE DATE FORMAT OF YYYYMMDDHHMMSS
'Sub Comment(af)
' Dim tsa
' Const ForAppending = 8
' set tsa=saf.OpenAsTextStream(ForAppending)
' tsa.writeline cstr(systime)
' tsa.close
'End Sub
Sub RenameSFile(sf)
StrNew=sf.ParentFolder &"\Customer-" & cstr(year(systime)) & cstr(month(systime)) & cstr(day(systime)) & cstr(hour(systime)) & cstr(minute(systime)) & cstr(second(systime))
sf.move StrNew
End Sub
Best,
Kos
User submitted from AEWNET (http://www.aewnet.com/)|||'**********************************************************************
' Visual Basic ActiveX Script
' Author: Keith Kosmicki
' Date 10 May 2005
' Purpose: Change file name after its been exported to Date Time Stamp
'************************************************************************
Function Main()
Main = DTSTaskExecResult_Success
End Function
Dim StrAccessSrc, StrNew, fso, sf, systime
StrAccessSrc = "\\Web1\ftp\Prime Vendor\test1"
Set fso = CreateObject("Scripting.FileSystemObject")
set saf = fso.GetFile(StrAccessSrc)
systime=now()
'Call Comment(ssf) 'ADD A TIMESTAMP AT THE END OF THE FILE SPECIFIED
Call RenameSFile(saf) 'RENAME THE SOURCE FILE WITH THE DATE FORMAT OF YYYYMMDDHHMMSS
'Sub Comment(af)
' Dim tsa
' Const ForAppending = 8
' set tsa=saf.OpenAsTextStream(ForAppending)
' tsa.writeline cstr(systime)
' tsa.close
'End Sub
Sub RenameSFile(sf)
StrNew=sf.ParentFolder &"\Customer-" & cstr(year(systime)) & cstr(month(systime)) & cstr(day(systime)) & cstr(hour(systime)) & cstr(minute(systime)) & cstr(second(systime))
sf.move StrNew
End Sub
Best,
Kos
User submitted from AEWNET (http://www.aewnet.com/)sql