Sunday, March 25, 2012
ActiveX
In VB Dir$ function could have been used, what should I use in ActiveX?
Thanks a lot for your helpI'm not sure how to rename the file but you might be able to use the xp_fileexist extended proc to see if the file is in the directory.|||This is a start:
Function Main()
Dim objFSO
Dim objFolder
Dim objFile
Dim fileName
Dim folderName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("\\server\share$\dir\")
folderName = "\\server\share$\dir\Archive\" & Month(Now) & Day(Now) & Year(Now) & "_" & Hour(Now) & Minute(Now) & Second(Now) & "\"
For Each objFile in objFolder.Files
objFSO.CreateFolder(folderName)
fileName = objFile.Path
objFSO.MoveFile fileName, folderName
Next
Main = DTSTaskExecResult_Success
End Function|||Now I'm getting what I need to do, thanks a lot for your help.sql
Monday, March 19, 2012
Active Directory Service And IIS Problem
Its working fine when running thru asp development server.
But while running thru IIS Server. It displays the following error
"An exception of type 'System.DirectoryServices.DirectoryServicesCOMException' occurred in System.DirectoryServices.dll but was not handled in user code
Additional information: Logon failure: unknown user name or bad password."
This is my Code :
Public Function readADSusers()
Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://spiretek.local")
Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
mySearcher.Filter = ("(objectClass=user)")
Dim resEnt As SearchResult
For Each resEnt In mySearcher.FindAll()
Select Case myKey
Case "samaccountname"
TextBox1.Text += myResultPropColl(myKey)(0)
End Select
Next
End Function
Please Help Me......This is not the right forum for this, but you will have to provide network credentials (either the current the process is running with or custom ones) to access the active directory.
Jens K. Suessmeyer.
http://www.sqlserver2005.de
Sunday, February 12, 2012
accessing remote databases thru agent jobs
The agent jobs call stored procedures created on
local databases.
We want to move the agent jobs to a different server
(remote server). How do we set up accessing the databases
from the remote server so that none of the agent jobs need to
be changed, or with minimum change.
TIA.You would have to set up linked severs. For more information and examples,
see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
Books Online.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121880962.361317.54810@.g44g2000cwa.googlegroups.com...
> We have some agents jobs which are run on schedule.
> The agent jobs call stored procedures created on
> local databases.
> We want to move the agent jobs to a different server
> (remote server). How do we set up accessing the databases
> from the remote server so that none of the agent jobs need to
> be changed, or with minimum change.
> TIA.
>|||Narayana Vyas Kondreddi wrote:
> You would have to set up linked severs. For more information and examples,
> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
> Books Online.
I too thought about the linked server option, but it seems it
still requires using a linked server name as the qualifier
for the database name.
this is the original code of the Agent job
-- Add the job steps
EXECUTE @.ReturnCode = msdb.dbo.sp_add_jobstep @.job_id = @.JobID,
@.step_id = 1, @.step_name =N'Purge', @.command = N'exec bts_CleanupDeadProcesses', @.database_name =N'BizTalkMsgBoxDb',
@.server = N'', @.database_user_name = N'', @.subsystem = N'TSQL',
@.cmdexec_success_code = 0, @.flags
= 0, @.retry_attempts = 0, @.retry_interval = 1, @.output_file_name = N'',
@.on_success_step_id = 0,
@.on_success_action = 1, @.on_fail_step_id = 0, @.on_fail_action = 2
Now how do i make the agent job refer to a remote database at the
parameter @.database_name = N'BizTalkMsgBoxDb' without qualifying it
with the linked server.
Thanks for your help.|||Narayana Vyas Kondreddi wrote:
> You would have to set up linked severs. For more information and examples,
> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
That's what my initial guess was. However when I add
a linked server, in the SQL Agent Job, I still need to
qualify the database name from MyDB to LINKEDSERVER.MyDB.
is there a way to avoid it. That is, is there a way for
Agent job to know the context of server is LINKEDSERVER.
Thanks for your help.|||No. Instead you could have a constant linked server name, by adding an alias
on the server, using Client Network Utility, and by adding a linked server
using the alias name. this way you could change the server name, but still
keep the same alias name.
Anyway, makes me curious why are you movig the job to a different server?
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121884794.983994.137000@.g43g2000cwa.googlegroups.com...
>
> Narayana Vyas Kondreddi wrote:
>> You would have to set up linked severs. For more information and
>> examples,
>> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL
>> Server
> That's what my initial guess was. However when I add
> a linked server, in the SQL Agent Job, I still need to
> qualify the database name from MyDB to LINKEDSERVER.MyDB.
> is there a way to avoid it. That is, is there a way for
> Agent job to know the context of server is LINKEDSERVER.
> Thanks for your help.
>|||Narayana Vyas Kondreddi wrote:
> No. Instead you could have a constant linked server name, by adding an alias
> on the server, using Client Network Utility, and by adding a linked server
> using the alias name. this way you could change the server name, but still
> keep the same alias name.
I am not sure how the above is relevant to my case. Please refer to
the code example I have posted in the other reply.
> Anyway, makes me curious why are you movig the job to a different server?
as you can see from the code snippet it is Biztalk jobs. We
are going to host our production server with a hosting company
and they do not support running application jobs on the
database server. So I am doing pro/con matrix to see how
much we have to change.|||Okay, you will have to make a change to the job step, if the server context
has to change.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121888749.038267.117940@.g49g2000cwa.googlegroups.com...
> Narayana Vyas Kondreddi wrote:
>> No. Instead you could have a constant linked server name, by adding an
>> alias
>> on the server, using Client Network Utility, and by adding a linked
>> server
>> using the alias name. this way you could change the server name, but
>> still
>> keep the same alias name.
> I am not sure how the above is relevant to my case. Please refer to
> the code example I have posted in the other reply.
>> Anyway, makes me curious why are you movig the job to a different server?
> as you can see from the code snippet it is Biztalk jobs. We
> are going to host our production server with a hosting company
> and they do not support running application jobs on the
> database server. So I am doing pro/con matrix to see how
> much we have to change.
>
accessing remote databases thru agent jobs
The agent jobs call stored procedures created on
local databases.
We want to move the agent jobs to a different server
(remote server). How do we set up accessing the databases
from the remote server so that none of the agent jobs need to
be changed, or with minimum change.
TIA.
You would have to set up linked severs. For more information and examples,
see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
Books Online.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121880962.361317.54810@.g44g2000cwa.googlegro ups.com...
> We have some agents jobs which are run on schedule.
> The agent jobs call stored procedures created on
> local databases.
> We want to move the agent jobs to a different server
> (remote server). How do we set up accessing the databases
> from the remote server so that none of the agent jobs need to
> be changed, or with minimum change.
> TIA.
>
|||Narayana Vyas Kondreddi wrote:
> You would have to set up linked severs. For more information and examples,
> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
> Books Online.
I too thought about the linked server option, but it seems it
still requires using a linked server name as the qualifier
for the database name.
this is the original code of the Agent job
-- Add the job steps
EXECUTE @.ReturnCode = msdb.dbo.sp_add_jobstep @.job_id = @.JobID,
@.step_id = 1, @.step_name =
N'Purge', @.command = N'exec bts_CleanupDeadProcesses', @.database_name =
N'BizTalkMsgBoxDb',
@.server = N'', @.database_user_name = N'', @.subsystem = N'TSQL',
@.cmdexec_success_code = 0, @.flags
= 0, @.retry_attempts = 0, @.retry_interval = 1, @.output_file_name = N'',
@.on_success_step_id = 0,
@.on_success_action = 1, @.on_fail_step_id = 0, @.on_fail_action = 2
Now how do i make the agent job refer to a remote database at the
parameter @.database_name = N'BizTalkMsgBoxDb' without qualifying it
with the linked server.
Thanks for your help.
|||Narayana Vyas Kondreddi wrote:
> You would have to set up linked severs. For more information and examples,
> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
That's what my initial guess was. However when I add
a linked server, in the SQL Agent Job, I still need to
qualify the database name from MyDB to LINKEDSERVER.MyDB.
is there a way to avoid it. That is, is there a way for
Agent job to know the context of server is LINKEDSERVER.
Thanks for your help.
|||No. Instead you could have a constant linked server name, by adding an alias
on the server, using Client Network Utility, and by adding a linked server
using the alias name. this way you could change the server name, but still
keep the same alias name.
Anyway, makes me curious why are you movig the job to a different server?
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121884794.983994.137000@.g43g2000cwa.googlegr oups.com...
>
> Narayana Vyas Kondreddi wrote:
> That's what my initial guess was. However when I add
> a linked server, in the SQL Agent Job, I still need to
> qualify the database name from MyDB to LINKEDSERVER.MyDB.
> is there a way to avoid it. That is, is there a way for
> Agent job to know the context of server is LINKEDSERVER.
> Thanks for your help.
>
|||Narayana Vyas Kondreddi wrote:
> No. Instead you could have a constant linked server name, by adding an alias
> on the server, using Client Network Utility, and by adding a linked server
> using the alias name. this way you could change the server name, but still
> keep the same alias name.
I am not sure how the above is relevant to my case. Please refer to
the code example I have posted in the other reply.
> Anyway, makes me curious why are you movig the job to a different server?
as you can see from the code snippet it is Biztalk jobs. We
are going to host our production server with a hosting company
and they do not support running application jobs on the
database server. So I am doing pro/con matrix to see how
much we have to change.
|||Okay, you will have to make a change to the job step, if the server context
has to change.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121888749.038267.117940@.g49g2000cwa.googlegr oups.com...
> Narayana Vyas Kondreddi wrote:
> I am not sure how the above is relevant to my case. Please refer to
> the code example I have posted in the other reply.
>
> as you can see from the code snippet it is Biztalk jobs. We
> are going to host our production server with a hosting company
> and they do not support running application jobs on the
> database server. So I am doing pro/con matrix to see how
> much we have to change.
>
accessing remote databases thru agent jobs
The agent jobs call stored procedures created on
local databases.
We want to move the agent jobs to a different server
(remote server). How do we set up accessing the databases
from the remote server so that none of the agent jobs need to
be changed, or with minimum change.
TIA.You would have to set up linked severs. For more information and examples,
see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server
Books Online.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121880962.361317.54810@.g44g2000cwa.googlegroups.com...
> We have some agents jobs which are run on schedule.
> The agent jobs call stored procedures created on
> local databases.
> We want to move the agent jobs to a different server
> (remote server). How do we set up accessing the databases
> from the remote server so that none of the agent jobs need to
> be changed, or with minimum change.
> TIA.
>|||Narayana Vyas Kondreddi wrote:
> You would have to set up linked severs. For more information and examples,
> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Serve
r
> Books Online.
I too thought about the linked server option, but it seems it
still requires using a linked server name as the qualifier
for the database name.
this is the original code of the Agent job
-- Add the job steps
EXECUTE @.ReturnCode = msdb.dbo.sp_add_jobstep @.job_id = @.JobID,
@.step_id = 1, @.step_name =
N'Purge', @.command = N'exec bts_CleanupDeadProcesses', @.database_name =
N'BizTalkMsgBoxDb',
@.server = N'', @.database_user_name = N'', @.subsystem = N'TSQL',
@.cmdexec_success_code = 0, @.flags
= 0, @.retry_attempts = 0, @.retry_interval = 1, @.output_file_name = N'',
@.on_success_step_id = 0,
@.on_success_action = 1, @.on_fail_step_id = 0, @.on_fail_action = 2
Now how do i make the agent job refer to a remote database at the
parameter @.database_name = N'BizTalkMsgBoxDb' without qualifying it
with the linked server.
Thanks for your help.|||Narayana Vyas Kondreddi wrote:[vbcol=seagreen]
> You would have to set up linked severs. For more information and examples,
> see sp_addlinkedserver, sp_addlinkedsrvlogin, sp_serveroption in SQL Server[/vbcol
]
That's what my initial guess was. However when I add
a linked server, in the SQL Agent Job, I still need to
qualify the database name from MyDB to LINKEDSERVER.MyDB.
is there a way to avoid it. That is, is there a way for
Agent job to know the context of server is LINKEDSERVER.
Thanks for your help.|||No. Instead you could have a constant linked server name, by adding an alias
on the server, using Client Network Utility, and by adding a linked server
using the alias name. this way you could change the server name, but still
keep the same alias name.
Anyway, makes me curious why are you movig the job to a different server?
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121884794.983994.137000@.g43g2000cwa.googlegroups.com...
>
> Narayana Vyas Kondreddi wrote:
> That's what my initial guess was. However when I add
> a linked server, in the SQL Agent Job, I still need to
> qualify the database name from MyDB to LINKEDSERVER.MyDB.
> is there a way to avoid it. That is, is there a way for
> Agent job to know the context of server is LINKEDSERVER.
> Thanks for your help.
>|||Narayana Vyas Kondreddi wrote:
> No. Instead you could have a constant linked server name, by adding an ali
as
> on the server, using Client Network Utility, and by adding a linked server
> using the alias name. this way you could change the server name, but still
> keep the same alias name.
I am not sure how the above is relevant to my case. Please refer to
the code example I have posted in the other reply.
> Anyway, makes me curious why are you movig the job to a different server?
as you can see from the code snippet it is Biztalk jobs. We
are going to host our production server with a hosting company
and they do not support running application jobs on the
database server. So I am doing pro/con matrix to see how
much we have to change.|||Okay, you will have to make a change to the job step, if the server context
has to change.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1121888749.038267.117940@.g49g2000cwa.googlegroups.com...
> Narayana Vyas Kondreddi wrote:
> I am not sure how the above is relevant to my case. Please refer to
> the code example I have posted in the other reply.
>
> as you can see from the code snippet it is Biztalk jobs. We
> are going to host our production server with a hosting company
> and they do not support running application jobs on the
> database server. So I am doing pro/con matrix to see how
> much we have to change.
>