Showing posts with label databasename. Show all posts
Showing posts with label databasename. Show all posts

Friday, February 24, 2012

Databasename Variable

declare @.rc int
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = N'SRVDB1@.mydomain.com',
@.TO = N'gmatteson@.mydomain',
@.priority = N'HIGH',
@.subject = N'Process Success',
@.message = N'Database Backup Succeeded.', - Rather than putting Database
Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
@.server = N'mail.mydomain.com',
@.attachment = N'F:\TEST.txt'
select RC = @.rc
GO
Anyone know how to do this, this is my first stored procedure and I really
have no idea how the syntax works! thanks.
You can't concatenate there, you'll have to build the message first.
DECLARE @.msg VARCHAR(255), @.rc INT
SET @.msg = @.databasename + ' Backup Succeeded.'
EXEC @.rc = master..xp_smtp_sendmail
...
@.message = @.msg,
What does this have to do with DTS, setup, security? Followups set to
..server only.
http://www.aspfaq.com/
(Reverse address to reply.)
"Gabe Matteson" <gmatteson@.inquery.biz.nospam> wrote in message
news:##3QnDqGFHA.544@.TK2MSFTNGP12.phx.gbl...
> declare @.rc int
> exec @.rc = master.dbo.xp_smtp_sendmail
> @.FROM = N'SRVDB1@.mydomain.com',
> @.TO = N'gmatteson@.mydomain',
> @.priority = N'HIGH',
> @.subject = N'Process Success',
> @.message = N'Database Backup Succeeded.', - Rather than putting Database
> Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
> @.server = N'mail.mydomain.com',
> @.attachment = N'F:\TEST.txt'
> select RC = @.rc
> GO
> Anyone know how to do this, this is my first stored procedure and I really
> have no idea how the syntax works! thanks.
>

Databasename Variable

declare @.rc int
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = N'SRVDB1@.mydomain.com',
@.TO = N'gmatteson@.mydomain',
@.priority = N'HIGH',
@.subject = N'Process Success',
@.message = N'Database Backup Succeeded.', - Rather than putting Database
Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
@.server = N'mail.mydomain.com',
@.attachment = N'F:\TEST.txt'
select RC = @.rc
GO
Anyone know how to do this, this is my first stored procedure and I really
have no idea how the syntax works! thanks.
You can't concatenate there, you'll have to build the message first.
DECLARE @.msg VARCHAR(255), @.rc INT
SET @.msg = @.databasename + ' Backup Succeeded.'
EXEC @.rc = master..xp_smtp_sendmail
...
@.message = @.msg,
What does this have to do with DTS, setup, security? Followups set to
..server only.
http://www.aspfaq.com/
(Reverse address to reply.)
"Gabe Matteson" <gmatteson@.inquery.biz.nospam> wrote in message
news:##3QnDqGFHA.544@.TK2MSFTNGP12.phx.gbl...
> declare @.rc int
> exec @.rc = master.dbo.xp_smtp_sendmail
> @.FROM = N'SRVDB1@.mydomain.com',
> @.TO = N'gmatteson@.mydomain',
> @.priority = N'HIGH',
> @.subject = N'Process Success',
> @.message = N'Database Backup Succeeded.', - Rather than putting Database
> Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
> @.server = N'mail.mydomain.com',
> @.attachment = N'F:\TEST.txt'
> select RC = @.rc
> GO
> Anyone know how to do this, this is my first stored procedure and I really
> have no idea how the syntax works! thanks.
>

Databasename Variable

declare @.rc int
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = N'SRVDB1@.mydomain.com',
@.TO = N'gmatteson@.mydomain',
@.priority = N'HIGH',
@.subject = N'Process Success',
@.message = N'Database Backup Succeeded.', - Rather than putting Database
Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
@.server = N'mail.mydomain.com',
@.attachment = N'F:\TEST.txt'
select RC = @.rc
GO
Anyone know how to do this, this is my first stored procedure and I really
have no idea how the syntax works! thanks.You can't concatenate there, you'll have to build the message first.
DECLARE @.msg VARCHAR(255), @.rc INT
SET @.msg = @.databasename + ' Backup Succeeded.'
EXEC @.rc = master..xp_smtp_sendmail
...
@.message = @.msg,
What does this have to do with DTS, setup, security? Followups set to
.server only.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Gabe Matteson" <gmatteson@.inquery.biz.nospam> wrote in message
news:##3QnDqGFHA.544@.TK2MSFTNGP12.phx.gbl...
> declare @.rc int
> exec @.rc = master.dbo.xp_smtp_sendmail
> @.FROM = N'SRVDB1@.mydomain.com',
> @.TO = N'gmatteson@.mydomain',
> @.priority = N'HIGH',
> @.subject = N'Process Success',
> @.message = N'Database Backup Succeeded.', - Rather than putting Database
> Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
> @.server = N'mail.mydomain.com',
> @.attachment = N'F:\TEST.txt'
> select RC = @.rc
> GO
> Anyone know how to do this, this is my first stored procedure and I really
> have no idea how the syntax works! thanks.
>

Databasename Variable

declare @.rc int
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = N'SRVDB1@.mydomain.com',
@.TO = N'gmatteson@.mydomain',
@.priority = N'HIGH',
@.subject = N'Process Success',
@.message = N'Database Backup Succeeded.', - Rather than putting Database
Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
@.server = N'mail.mydomain.com',
@.attachment = N'F:\TEST.txt'
select RC = @.rc
GO
Anyone know how to do this, this is my first stored procedure and I really
have no idea how the syntax works! thanks.You can't concatenate there, you'll have to build the message first.
DECLARE @.msg VARCHAR(255), @.rc INT
SET @.msg = @.databasename + ' Backup Succeeded.'
EXEC @.rc = master..xp_smtp_sendmail
..
@.message = @.msg,
What does this have to do with DTS, setup, security? Followups set to
.server only.
http://www.aspfaq.com/
(Reverse address to reply.)
"Gabe Matteson" <gmatteson@.inquery.biz.nospam> wrote in message
news:##3QnDqGFHA.544@.TK2MSFTNGP12.phx.gbl...
> declare @.rc int
> exec @.rc = master.dbo.xp_smtp_sendmail
> @.FROM = N'SRVDB1@.mydomain.com',
> @.TO = N'gmatteson@.mydomain',
> @.priority = N'HIGH',
> @.subject = N'Process Success',
> @.message = N'Database Backup Succeeded.', - Rather than putting Database
> Backup Succeeded, I would like to put "@.databasename Backup Succeeded".
> @.server = N'mail.mydomain.com',
> @.attachment = N'F:\TEST.txt'
> select RC = @.rc
> GO
> Anyone know how to do this, this is my first stored procedure and I really
> have no idea how the syntax works! thanks.
>

DatabaseName Problem

DECLARE @.DatabaseName varchar(10)
DECLARE @.OwnerName varchar(10)
DECLARE @.TableName varchar(10)

SET @.DatabaseName='TempDatabase'
SET @.OwnerName='XYZ'
SET @.TableName='TempTable'

select * from @.DatabaseName.@.OwnerName.@.TableName

this is not working.

SEND ME HELP AS SOON AS POSSIBLEDECLARE @.DatabaseName varchar(10)
DECLARE @.OwnerName varchar(10)
DECLARE @.TableName varchar(10)

SET @.DatabaseName='TempDatabase'
SET @.OwnerName='XYZ'
SET @.TableName='TempTable'

select * from @.DatabaseName.@.OwnerName.@.TableName

this is not working.

SEND ME HELP AS SOON AS POSSIBLE
you will have to use dynamic sql something like this:

DECLARE @.DatabaseName varchar(10)
DECLARE @.OwnerName varchar(10)
DECLARE @.TableName varchar(10)
declare @.sql nvarchar(1000)
SET @.DatabaseName='databasename'
SET @.OwnerName='dbo'
SET @.TableName='tablename'

set @.sql='select * from '+@.DatabaseName+'.'+@.OwnerName+'.'+@.TableName

exec @.sql|||It would also help to not assign 12 characters to a 10 character varchar().|||...but who's counting...

DatabaseName is blank in Trace

I am using SQL 2000.
I am taking trace and execute an sp_trace_setevent for all
the events I want to record. One of the fields I want is
the DatabaseName, so I execute:
exec sp_trace_setevent @.TraceID, 10, 35,1
When I view the trace, I get all the column names (server,
DBID, DatabaseName, etc.). There is data in all the
columns except the DatabaseName field is blank.
I know I can work around this by doing a join with the
DBID and Sysdatabases, but I find it strange that the
DatabaseName field is blank.
Has anyone else experienced this? Anyone have any ideas?
Thanks.It's not unusual - the names for DatabaseName (as well as
ObjectName) can't always be obtained as they aren't
available for every event. Use DatabaseID instead.
-Sue
On Wed, 1 Oct 2003 08:17:47 -0700, "dschrier"
<deena_schrier@.viarail.ca> wrote:
>I am using SQL 2000.
>I am taking trace and execute an sp_trace_setevent for all
>the events I want to record. One of the fields I want is
>the DatabaseName, so I execute:
>exec sp_trace_setevent @.TraceID, 10, 35,1
>When I view the trace, I get all the column names (server,
>DBID, DatabaseName, etc.). There is data in all the
>columns except the DatabaseName field is blank.
>I know I can work around this by doing a join with the
>DBID and Sysdatabases, but I find it strange that the
>DatabaseName field is blank.
>Has anyone else experienced this? Anyone have any ideas?
>Thanks.
>
>
>

DatabaseName Database ID Map?

Hi...
In SQL Profiler, it is easy enough to the the database ID from a trace.
That said, it would be nice to know what database the ID number
represents. How can I map the database ID to it's human-friendly name?
Thanks,
JohnSELECT DB_NAME(<dbid> )
http://www.aspfaq.com/
(Reverse address to reply.)
<jpuopolo@.mvisiontechnology.com> wrote in message
news:1109369484.318741.212180@.o13g2000cwo.googlegroups.com...
> Hi...
> In SQL Profiler, it is easy enough to the the database ID from a trace.
> That said, it would be nice to know what database the ID number
> represents. How can I map the database ID to it's human-friendly name?
> Thanks,
> John
>|||Aaron:
Couldn't be easier! Thanks.
John
Aaron [SQL Server MVP] wrote:
> SELECT DB_NAME(<dbid> )
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> <jpuopolo@.mvisiontechnology.com> wrote in message
> news:1109369484.318741.212180@.o13g2000cwo.googlegroups.com...
trace.
name?

DatabaseName data column is blank in Profiler

Hello!
I am trying to figure out when DatabaseName Data column in SQL Trace is
always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
Any help is greatly appreciated,
IgorHi
It is not always captured!
http://tinyurl.com/3m6xm
http://tinyurl.com/4t9wb
John
"Igor Marchenko" <igormarchenko@.hotmail.com> wrote in message
news:epuZDeyCFHA.1188@.tk2msftngp13.phx.gbl...
> Hello!
> I am trying to figure out when DatabaseName Data column in SQL Trace is
> always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
> Any help is greatly appreciated,
> Igor
>

DatabaseName data column is blank in Profiler

Hello!
I am trying to figure out when DatabaseName Data column in SQL Trace is
always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
Any help is greatly appreciated,
Igor
Hi
It is not always captured!
http://tinyurl.com/3m6xm
http://tinyurl.com/4t9wb
John
"Igor Marchenko" <igormarchenko@.hotmail.com> wrote in message
news:epuZDeyCFHA.1188@.tk2msftngp13.phx.gbl...
> Hello!
> I am trying to figure out when DatabaseName Data column in SQL Trace is
> always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
> Any help is greatly appreciated,
> Igor
>

DatabaseName data column is blank in Profiler

Hello!
I am trying to figure out when DatabaseName Data column in SQL Trace is
always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
Any help is greatly appreciated,
IgorHi
It is not always captured!
http://tinyurl.com/3m6xm
http://tinyurl.com/4t9wb
John
"Igor Marchenko" <igormarchenko@.hotmail.com> wrote in message
news:epuZDeyCFHA.1188@.tk2msftngp13.phx.gbl...
> Hello!
> I am trying to figure out when DatabaseName Data column in SQL Trace is
> always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
> Any help is greatly appreciated,
> Igor
>

DatabaseName data column in Profiler is blank

Hello!
I am trying to figure out when DatabaseName Data column in SQL Trace is
always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
Any help is greatly appreciated,
Igor
It's only populated for certain security related events. It won't be
populated for events like Batch Completed or SP Completed. When I load a
trace into a table I tend to have an auxillary table with the databaseid +
name and then create a view to look at the trace so I get the database name.
I do a similar thing with the Event column (you can find the names for the
eventid's in BOL)
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Igor Marchenko" <igormarchenko@.hotmail.com> wrote in message
news:OlgV2dyCFHA.2288@.TK2MSFTNGP14.phx.gbl...
> Hello!
> I am trying to figure out when DatabaseName Data column in SQL Trace is
> always blank. I am executing SQL Batch. I can see DatabaseID but not Name.
> Any help is greatly appreciated,
> Igor
>
|||Thanks a lot,
Igor
"Jasper Smith" <jasper_smith9@.hotmail.com> wrote in message
news:eplEBP3CFHA.228@.tk2msftngp13.phx.gbl...
> It's only populated for certain security related events. It won't be
> populated for events like Batch Completed or SP Completed. When I load a
> trace into a table I tend to have an auxillary table with the databaseid +
> name and then create a view to look at the trace so I get the database
> name. I do a similar thing with the Event column (you can find the names
> for the eventid's in BOL)
> --
> HTH
> Jasper Smith (SQL Server MVP)
> http://www.sqldbatips.com
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
> "Igor Marchenko" <igormarchenko@.hotmail.com> wrote in message
> news:OlgV2dyCFHA.2288@.TK2MSFTNGP14.phx.gbl...
>