Showing posts with label vbscript. Show all posts
Showing posts with label vbscript. Show all posts

Friday, February 24, 2012

Creating messages from SQL to the Windows Event Viewer app log

(For MS SQL 2000... Please don't suggest anything using VB or .NET. I need
something either somehow built-in with SQL 2000 or using VBscript.)
Anyone know of a way to create a test message somehow through MS SQL so that
it shows in the Windows application event log?
For example, would creating a job to run a dummy stored procedure create an
entry in the app event log?
(Problem is that when SQL is clustered, it uses a different 'source' name in
the event viewer. The 'source' name can't be different when writing a
simple script from what I can tell. I need to be able to easily create test
messages using the SQL cluster name.)
MarcoMarco Shaw wrote:
> (For MS SQL 2000... Please don't suggest anything using VB or .NET. I need
> something either somehow built-in with SQL 2000 or using VBscript.)
> Anyone know of a way to create a test message somehow through MS SQL so that
> it shows in the Windows application event log?
> For example, would creating a job to run a dummy stored procedure create an
> entry in the app event log?
> (Problem is that when SQL is clustered, it uses a different 'source' name in
> the event viewer. The 'source' name can't be different when writing a
> simple script from what I can tell. I need to be able to easily create test
> messages using the SQL cluster name.)
> Marco
>
>
Have you looked at RAISERROR?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||This is a multi-part message in MIME format.
--=_NextPart_000_06FD_01C6A732.93A36440
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
RAISERROR( 'This is a test event message', 10, 1 ) WITH LOG
-- Arnie Rowland
"To be successful, your heart must accompany your knowledge."
"Marco Shaw" <marco@.Znbnet.nb.ca> wrote in message =news:OAXoOx2pGHA.1600@.TK2MSFTNGP04.phx.gbl...
> (For MS SQL 2000... Please don't suggest anything using VB or .NET. =I need
> something either somehow built-in with SQL 2000 or using VBscript.)
> > Anyone know of a way to create a test message somehow through MS SQL =so that
> it shows in the Windows application event log?
> > For example, would creating a job to run a dummy stored procedure =create an
> entry in the app event log?
> > (Problem is that when SQL is clustered, it uses a different 'source' =name in
> the event viewer. The 'source' name can't be different when writing a
> simple script from what I can tell. I need to be able to easily =create test
> messages using the SQL cluster name.)
> > Marco
> > >
--=_NextPart_000_06FD_01C6A732.93A36440
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

RAISERROR( 'This is a test =event message', 10, 1 ) WITH LOG
-- Arnie Rowland"To be =successful, your heart must accompany your knowledge."
"Marco Shaw" =wrote in message news:OAXoOx2pGHA.1600@.TK2MSFTNGP04.phx.gbl...> =(For MS SQL 2000... Please don't suggest anything using VB or .NET. I need> something either somehow built-in with SQL 2000 or using VBscript.)> > Anyone know of a way to create a test =message somehow through MS SQL so that> it shows in the Windows =application event log?> > For example, would creating a job to run a dummy =stored procedure create an> entry in the app event log?> > =(Problem is that when SQL is clustered, it uses a different 'source' =name in> the event viewer. The 'source' name can't be different =when writing a> simple script from what I can tell. I need to be =able to easily create test> messages using the SQL cluster name.)> => Marco> > >

--=_NextPart_000_06FD_01C6A732.93A36440--

Creating Job with ActiveX script

Hi,
Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
file.
However, I wanted to schedule the process so I created a job that runs this
script with the step as an ActiveX script step.
However, I get the error: Error 14277 Command script does not destroy all
objects it creates.
I checked the code and I only create two SQL-DMO objects of which I both set
to 'Nothing' at the end.
Have checked MS Knowledge Base and Internet but find nothing on it, other
that use DTS instead. I can do that but wondered why this error should occur.
Using SQL Server 7.0, SP3. Thanks.
These objects do not need to be created explicitly with CreateObject. Any
variable assigned with Set is an object and will need to be set to Nothing.
ie
Set sql = CreateObject("SQLOLEDB.Connection")
...
Set rs = sq.Execute("SELECT name from master.dbo.sysdatabases")
Set rs = Nothing
Set sql = Nothing
Regards
Barry McAuslin
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"PRW" <PRW@.discussions.microsoft.com> wrote in message
news:BF401CF0-746F-43C4-B551-6DE1A8C6042D@.microsoft.com...
> Hi,
> Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
> file.
> However, I wanted to schedule the process so I created a job that runs
this
> script with the step as an ActiveX script step.
> However, I get the error: Error 14277 Command script does not destroy all
> objects it creates.
> I checked the code and I only create two SQL-DMO objects of which I both
set
> to 'Nothing' at the end.
> Have checked MS Knowledge Base and Internet but find nothing on it, other
> that use DTS instead. I can do that but wondered why this error should
occur.
> Using SQL Server 7.0, SP3. Thanks.

Creating Job with ActiveX script

Hi,
Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
file.
However, I wanted to schedule the process so I created a job that runs this
script with the step as an ActiveX script step.
However, I get the error: Error 14277 Command script does not destroy all
objects it creates.
I checked the code and I only create two SQL-DMO objects of which I both set
to 'Nothing' at the end.
Have checked MS Knowledge Base and Internet but find nothing on it, other
that use DTS instead. I can do that but wondered why this error should occur.
Using SQL Server 7.0, SP3. Thanks.These objects do not need to be created explicitly with CreateObject. Any
variable assigned with Set is an object and will need to be set to Nothing.
ie
Set sql = CreateObject("SQLOLEDB.Connection")
...
Set rs = sq.Execute("SELECT name from master.dbo.sysdatabases")
Set rs = Nothing
Set sql = Nothing
--
Regards
Barry McAuslin
----
--
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"PRW" <PRW@.discussions.microsoft.com> wrote in message
news:BF401CF0-746F-43C4-B551-6DE1A8C6042D@.microsoft.com...
> Hi,
> Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
> file.
> However, I wanted to schedule the process so I created a job that runs
this
> script with the step as an ActiveX script step.
> However, I get the error: Error 14277 Command script does not destroy all
> objects it creates.
> I checked the code and I only create two SQL-DMO objects of which I both
set
> to 'Nothing' at the end.
> Have checked MS Knowledge Base and Internet but find nothing on it, other
> that use DTS instead. I can do that but wondered why this error should
occur.
> Using SQL Server 7.0, SP3. Thanks.

Creating Job with ActiveX script

Hi,
Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
file.
However, I wanted to schedule the process so I created a job that runs this
script with the step as an ActiveX script step.
However, I get the error: Error 14277 Command script does not destroy all
objects it creates.
I checked the code and I only create two SQL-DMO objects of which I both set
to 'Nothing' at the end.
Have checked MS Knowledge Base and Internet but find nothing on it, other
that use DTS instead. I can do that but wondered why this error should occur
.
Using SQL Server 7.0, SP3. Thanks.These objects do not need to be created explicitly with CreateObject. Any
variable assigned with Set is an object and will need to be set to Nothing.
ie
Set sql = CreateObject("SQLOLEDB.Connection")
...
Set rs = sq.Execute("SELECT name from master.dbo.sysdatabases")
Set rs = Nothing
Set sql = Nothing
Regards
Barry McAuslin
----
--
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"PRW" <PRW@.discussions.microsoft.com> wrote in message
news:BF401CF0-746F-43C4-B551-6DE1A8C6042D@.microsoft.com...
> Hi,
> Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
> file.
> However, I wanted to schedule the process so I created a job that runs
this
> script with the step as an ActiveX script step.
> However, I get the error: Error 14277 Command script does not destroy all
> objects it creates.
> I checked the code and I only create two SQL-DMO objects of which I both
set
> to 'Nothing' at the end.
> Have checked MS Knowledge Base and Internet but find nothing on it, other
> that use DTS instead. I can do that but wondered why this error should
occur.
> Using SQL Server 7.0, SP3. Thanks.