Hi,
I am under the impression that the master database contains all log-in
info for each database, is that correct?
How about the server log-in? If i need to do the server migration, i need
to transfer all the server log-in manually (or using DTS Transfer log-in task)
is that true?
Thanks a lot
Ed
See if this helps:
http://support.microsoft.com/default...b;en-us;246133
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
Hi,
I am under the impression that the master database contains all log-in
info for each database, is that correct?
How about the server log-in? If i need to do the server migration, i need
to transfer all the server log-in manually (or using DTS Transfer log-in
task)
is that true?
Thanks a lot
Ed
|||No that is not correct.
Server logins are kept in master.dbo.sysxlogins table, or better yet,
syslogins view.
Each database keeps their own user accounts in sysusers table.
When you move to a new server, you may encounter orphaned users when
restoring databases because the new server SID does not match the source
SID. You can use sp_change_users_login to resync the SID, or use
sp_help_revlogin to script out all logins with their original SIDs and run
it to create logins on the new server.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
> Hi,
> I am under the impression that the master database contains all log-in
> info for each database, is that correct?
> How about the server log-in? If i need to do the server migration, i
need
> to transfer all the server log-in manually (or using DTS Transfer log-in
task)
> is that true?
> Thanks a lot
> Ed
|||Richard,
So if i do a server migration, I need to take care of the Server Log-in
first or User databases Log-in first or doesn't matter...
Thanks again
Ed
"Richard Ding" wrote:
> No that is not correct.
> Server logins are kept in master.dbo.sysxlogins table, or better yet,
> syslogins view.
> Each database keeps their own user accounts in sysusers table.
> When you move to a new server, you may encounter orphaned users when
> restoring databases because the new server SID does not match the source
> SID. You can use sp_change_users_login to resync the SID, or use
> sp_help_revlogin to script out all logins with their original SIDs and run
> it to create logins on the new server.
>
>
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
> need
> task)
>
>
|||The way I do when migrate server is to install the SQL server first. then
use sp_help_revlogin to create all logins on the new server. Next start
restoring user databases as well as msdb.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:C385D215-78F3-41BF-92BB-6F5431A1BC44@.microsoft.com...[vbcol=seagreen]
> Richard,
> So if i do a server migration, I need to take care of the Server Log-in
> first or User databases Log-in first or doesn't matter...
> Thanks again
> Ed
> "Richard Ding" wrote:
run[vbcol=seagreen]
log-in[vbcol=seagreen]
i[vbcol=seagreen]
log-in[vbcol=seagreen]
|||Richard,
Do you also have any idea about how to restore the Master Database?
What I am planning to do is
1. Backup (Old Server) all the databases (User and System) to a share folder
2. Create each individual user database in New Server
3. Restore each user database and retrive the backup files from the share
folder
4. Restore MSDB, MODEL database
5. Use DTS to transfer all the server log-in to New Server
is there anything wrong on doing this? How about dealing with the Master
Database, it needs to be transfered, too......
Thank you very much
Ed
"Richard Ding" wrote:
> The way I do when migrate server is to install the SQL server first. then
> use sp_help_revlogin to create all logins on the new server. Next start
> restoring user databases as well as msdb.
>
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:C385D215-78F3-41BF-92BB-6F5431A1BC44@.microsoft.com...
> run
> log-in
> i
> log-in
>
>
|||If you plan to restore master, you need to put the server in single user
mode and run restore master from tape or disk. Refer to BOL on "how to
restore master db".
You don't need to do 2. Try restore master first then user dbs.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:CB2F7FD9-22F4-4721-B60E-8988C2589062@.microsoft.com...
> Richard,
> Do you also have any idea about how to restore the Master Database?
> What I am planning to do is
> 1. Backup (Old Server) all the databases (User and System) to a share
folder[vbcol=seagreen]
> 2. Create each individual user database in New Server
> 3. Restore each user database and retrive the backup files from the share
> folder
> 4. Restore MSDB, MODEL database
> 5. Use DTS to transfer all the server log-in to New Server
> is there anything wrong on doing this? How about dealing with the Master
> Database, it needs to be transfered, too......
> Thank you very much
> Ed
>
>
> "Richard Ding" wrote:
then[vbcol=seagreen]
Log-in[vbcol=seagreen]
yet,[vbcol=seagreen]
source[vbcol=seagreen]
and[vbcol=seagreen]
migration,[vbcol=seagreen]
Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts
Friday, March 9, 2012
Login
Labels:
contains,
correcthow,
database,
impression,
log-in,
log-ininfo,
login,
master,
microsoft,
mysql,
oracle,
server,
sql
Login
Hi,
I am under the impression that the master database contains all log-in
info for each database, is that correct?
How about the server log-in? If i need to do the server migration, i need
to transfer all the server log-in manually (or using DTS Transfer log-in tas
k)
is that true?
Thanks a lot
EdSee if this helps:
http://support.microsoft.com/defaul...kb;en-us;246133
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
Hi,
I am under the impression that the master database contains all log-in
info for each database, is that correct?
How about the server log-in? If i need to do the server migration, i need
to transfer all the server log-in manually (or using DTS Transfer log-in
task)
is that true?
Thanks a lot
Ed|||No that is not correct.
Server logins are kept in master.dbo.sysxlogins table, or better yet,
syslogins view.
Each database keeps their own user accounts in sysusers table.
When you move to a new server, you may encounter orphaned users when
restoring databases because the new server SID does not match the source
SID. You can use sp_change_users_login to resync the SID, or use
sp_help_revlogin to script out all logins with their original SIDs and run
it to create logins on the new server.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
> Hi,
> I am under the impression that the master database contains all log-in
> info for each database, is that correct?
> How about the server log-in? If i need to do the server migration, i
need
> to transfer all the server log-in manually (or using DTS Transfer log-in
task)
> is that true?
> Thanks a lot
> Ed|||Richard,
So if i do a server migration, I need to take care of the Server Log-in
first or User databases Log-in first or doesn't matter...
Thanks again
Ed
"Richard Ding" wrote:
> No that is not correct.
> Server logins are kept in master.dbo.sysxlogins table, or better yet,
> syslogins view.
> Each database keeps their own user accounts in sysusers table.
> When you move to a new server, you may encounter orphaned users when
> restoring databases because the new server SID does not match the source
> SID. You can use sp_change_users_login to resync the SID, or use
> sp_help_revlogin to script out all logins with their original SIDs and run
> it to create logins on the new server.
>
>
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
> need
> task)
>
>|||The way I do when migrate server is to install the SQL server first. then
use sp_help_revlogin to create all logins on the new server. Next start
restoring user databases as well as msdb.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:C385D215-78F3-41BF-92BB-6F5431A1BC44@.microsoft.com...[vbcol=seagreen]
> Richard,
> So if i do a server migration, I need to take care of the Server Log-in
> first or User databases Log-in first or doesn't matter...
> Thanks again
> Ed
> "Richard Ding" wrote:
>
run[vbcol=seagreen]
log-in[vbcol=seagreen]
i[vbcol=seagreen]
log-in[vbcol=seagreen]|||Richard,
Do you also have any idea about how to restore the Master Database?
What I am planning to do is
1. Backup (Old Server) all the databases (User and System) to a share folder
2. Create each individual user database in New Server
3. Restore each user database and retrive the backup files from the share
folder
4. Restore MSDB, MODEL database
5. Use DTS to transfer all the server log-in to New Server
is there anything wrong on doing this? How about dealing with the Master
Database, it needs to be transfered, too......
Thank you very much
Ed
"Richard Ding" wrote:
> The way I do when migrate server is to install the SQL server first. then
> use sp_help_revlogin to create all logins on the new server. Next start
> restoring user databases as well as msdb.
>
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:C385D215-78F3-41BF-92BB-6F5431A1BC44@.microsoft.com...
> run
> log-in
> i
> log-in
>
>|||If you plan to restore master, you need to put the server in single user
mode and run restore master from tape or disk. Refer to BOL on "how to
restore master db".
You don't need to do 2. Try restore master first then user dbs.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:CB2F7FD9-22F4-4721-B60E-8988C2589062@.microsoft.com...
> Richard,
> Do you also have any idea about how to restore the Master Database?
> What I am planning to do is
> 1. Backup (Old Server) all the databases (User and System) to a share
folder[vbcol=seagreen]
> 2. Create each individual user database in New Server
> 3. Restore each user database and retrive the backup files from the share
> folder
> 4. Restore MSDB, MODEL database
> 5. Use DTS to transfer all the server log-in to New Server
> is there anything wrong on doing this? How about dealing with the Master
> Database, it needs to be transfered, too......
> Thank you very much
> Ed
>
>
> "Richard Ding" wrote:
>
then[vbcol=seagreen]
Log-in[vbcol=seagreen]
yet,[vbcol=seagreen]
source[vbcol=seagreen]
and[vbcol=seagreen]
migration,[vbcol=seagreen]
I am under the impression that the master database contains all log-in
info for each database, is that correct?
How about the server log-in? If i need to do the server migration, i need
to transfer all the server log-in manually (or using DTS Transfer log-in tas
k)
is that true?
Thanks a lot
EdSee if this helps:
http://support.microsoft.com/defaul...kb;en-us;246133
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
Hi,
I am under the impression that the master database contains all log-in
info for each database, is that correct?
How about the server log-in? If i need to do the server migration, i need
to transfer all the server log-in manually (or using DTS Transfer log-in
task)
is that true?
Thanks a lot
Ed|||No that is not correct.
Server logins are kept in master.dbo.sysxlogins table, or better yet,
syslogins view.
Each database keeps their own user accounts in sysusers table.
When you move to a new server, you may encounter orphaned users when
restoring databases because the new server SID does not match the source
SID. You can use sp_change_users_login to resync the SID, or use
sp_help_revlogin to script out all logins with their original SIDs and run
it to create logins on the new server.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
> Hi,
> I am under the impression that the master database contains all log-in
> info for each database, is that correct?
> How about the server log-in? If i need to do the server migration, i
need
> to transfer all the server log-in manually (or using DTS Transfer log-in
task)
> is that true?
> Thanks a lot
> Ed|||Richard,
So if i do a server migration, I need to take care of the Server Log-in
first or User databases Log-in first or doesn't matter...
Thanks again
Ed
"Richard Ding" wrote:
> No that is not correct.
> Server logins are kept in master.dbo.sysxlogins table, or better yet,
> syslogins view.
> Each database keeps their own user accounts in sysusers table.
> When you move to a new server, you may encounter orphaned users when
> restoring databases because the new server SID does not match the source
> SID. You can use sp_change_users_login to resync the SID, or use
> sp_help_revlogin to script out all logins with their original SIDs and run
> it to create logins on the new server.
>
>
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:0FA72DC1-AF86-422E-96CA-FCB183B4FE66@.microsoft.com...
> need
> task)
>
>|||The way I do when migrate server is to install the SQL server first. then
use sp_help_revlogin to create all logins on the new server. Next start
restoring user databases as well as msdb.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:C385D215-78F3-41BF-92BB-6F5431A1BC44@.microsoft.com...[vbcol=seagreen]
> Richard,
> So if i do a server migration, I need to take care of the Server Log-in
> first or User databases Log-in first or doesn't matter...
> Thanks again
> Ed
> "Richard Ding" wrote:
>
run[vbcol=seagreen]
log-in[vbcol=seagreen]
i[vbcol=seagreen]
log-in[vbcol=seagreen]|||Richard,
Do you also have any idea about how to restore the Master Database?
What I am planning to do is
1. Backup (Old Server) all the databases (User and System) to a share folder
2. Create each individual user database in New Server
3. Restore each user database and retrive the backup files from the share
folder
4. Restore MSDB, MODEL database
5. Use DTS to transfer all the server log-in to New Server
is there anything wrong on doing this? How about dealing with the Master
Database, it needs to be transfered, too......
Thank you very much
Ed
"Richard Ding" wrote:
> The way I do when migrate server is to install the SQL server first. then
> use sp_help_revlogin to create all logins on the new server. Next start
> restoring user databases as well as msdb.
>
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:C385D215-78F3-41BF-92BB-6F5431A1BC44@.microsoft.com...
> run
> log-in
> i
> log-in
>
>|||If you plan to restore master, you need to put the server in single user
mode and run restore master from tape or disk. Refer to BOL on "how to
restore master db".
You don't need to do 2. Try restore master first then user dbs.
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:CB2F7FD9-22F4-4721-B60E-8988C2589062@.microsoft.com...
> Richard,
> Do you also have any idea about how to restore the Master Database?
> What I am planning to do is
> 1. Backup (Old Server) all the databases (User and System) to a share
folder[vbcol=seagreen]
> 2. Create each individual user database in New Server
> 3. Restore each user database and retrive the backup files from the share
> folder
> 4. Restore MSDB, MODEL database
> 5. Use DTS to transfer all the server log-in to New Server
> is there anything wrong on doing this? How about dealing with the Master
> Database, it needs to be transfered, too......
> Thank you very much
> Ed
>
>
> "Richard Ding" wrote:
>
then[vbcol=seagreen]
Log-in[vbcol=seagreen]
yet,[vbcol=seagreen]
source[vbcol=seagreen]
and[vbcol=seagreen]
migration,[vbcol=seagreen]
Labels:
contains,
correcthow,
database,
impression,
log-in,
log-ininfo,
login,
master,
microsoft,
mysql,
oracle,
server,
sql
Monday, February 20, 2012
Logging query errors
Hi,
Is there a way to log errors raised while running a query. For instance a
table contains a duplicate entry and a scheduled query notices this. Is it
then possible to get an alert in for instance the SQL log?
Greets,
Fred
Fred
If you are on SQL Server 2005 take a look at Notification Services in the
BOL
One method is
IF EXISTS(SELECT *
FROM TableA
WHERE col = @.key
GROUP BY col
HAVING COUNT(*)>1)
BEGIN
RAISERROR ('There are duplicates in the table',16, 1)
END
ELSE
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred
|||I'm using SQL 2000. Would the query below also work on 2000?
"Uri Dimant" wrote:
> Fred
> If you are on SQL Server 2005 take a look at Notification Services in the
> BOL
>
> One method is
> IF EXISTS(SELECT *
> FROM TableA
> WHERE col = @.key
> GROUP BY col
> HAVING COUNT(*)>1)
> BEGIN
> RAISERROR ('There are duplicates in the table',16, 1)
> END
> ELSE
>
>
> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
>
>
|||Fred
Yes
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:AB5685F6-EF5D-4346-A4C0-A8D02D54DDFB@.microsoft.com...[vbcol=seagreen]
> I'm using SQL 2000. Would the query below also work on 2000?
> "Uri Dimant" wrote:
Is there a way to log errors raised while running a query. For instance a
table contains a duplicate entry and a scheduled query notices this. Is it
then possible to get an alert in for instance the SQL log?
Greets,
Fred
Fred
If you are on SQL Server 2005 take a look at Notification Services in the
BOL
One method is
IF EXISTS(SELECT *
FROM TableA
WHERE col = @.key
GROUP BY col
HAVING COUNT(*)>1)
BEGIN
RAISERROR ('There are duplicates in the table',16, 1)
END
ELSE
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred
|||I'm using SQL 2000. Would the query below also work on 2000?
"Uri Dimant" wrote:
> Fred
> If you are on SQL Server 2005 take a look at Notification Services in the
> BOL
>
> One method is
> IF EXISTS(SELECT *
> FROM TableA
> WHERE col = @.key
> GROUP BY col
> HAVING COUNT(*)>1)
> BEGIN
> RAISERROR ('There are duplicates in the table',16, 1)
> END
> ELSE
>
>
> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
>
>
|||Fred
Yes
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:AB5685F6-EF5D-4346-A4C0-A8D02D54DDFB@.microsoft.com...[vbcol=seagreen]
> I'm using SQL 2000. Would the query below also work on 2000?
> "Uri Dimant" wrote:
Logging query errors
Hi,
Is there a way to log errors raised while running a query. For instance a
table contains a duplicate entry and a scheduled query notices this. Is it
then possible to get an alert in for instance the SQL log?
Greets,
FredFred
If you are on SQL Server 2005 take a look at Notification Services in the
BOL
One method is
IF EXISTS(SELECT *
FROM TableA
WHERE col = @.key
GROUP BY col
HAVING COUNT(*)>1)
BEGIN
RAISERROR ('There are duplicates in the table',16, 1)
END
ELSE
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||Not really without catching that error in the client code. If you want to do this at the TSQL level:
2000: You can only capture the error number using @.@.ERROR
2005: You can capture almost anything you want, using functions such as ERROR_MESSAGE(),
ERROR_NUMBER(). Do read up on TRY/CATCH if you want to go this route.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||I'm using SQL 2000. Would the query below also work on 2000?
"Uri Dimant" wrote:
> Fred
> If you are on SQL Server 2005 take a look at Notification Services in the
> BOL
>
> One method is
> IF EXISTS(SELECT *
> FROM TableA
> WHERE col = @.key
> GROUP BY col
> HAVING COUNT(*)>1)
> BEGIN
> RAISERROR ('There are duplicates in the table',16, 1)
> END
> ELSE
>
>
> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> > Hi,
> >
> > Is there a way to log errors raised while running a query. For instance a
> > table contains a duplicate entry and a scheduled query notices this. Is it
> > then possible to get an alert in for instance the SQL log?
> >
> > Greets,
> >
> > Fred
>
>|||Fred
Yes
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:AB5685F6-EF5D-4346-A4C0-A8D02D54DDFB@.microsoft.com...
> I'm using SQL 2000. Would the query below also work on 2000?
> "Uri Dimant" wrote:
>> Fred
>> If you are on SQL Server 2005 take a look at Notification Services in the
>> BOL
>>
>> One method is
>> IF EXISTS(SELECT *
>> FROM TableA
>> WHERE col = @.key
>> GROUP BY col
>> HAVING COUNT(*)>1)
>> BEGIN
>> RAISERROR ('There are duplicates in the table',16, 1)
>> END
>> ELSE
>>
>>
>> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
>> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
>> > Hi,
>> >
>> > Is there a way to log errors raised while running a query. For instance
>> > a
>> > table contains a duplicate entry and a scheduled query notices this. Is
>> > it
>> > then possible to get an alert in for instance the SQL log?
>> >
>> > Greets,
>> >
>> > Fred
>>
Is there a way to log errors raised while running a query. For instance a
table contains a duplicate entry and a scheduled query notices this. Is it
then possible to get an alert in for instance the SQL log?
Greets,
FredFred
If you are on SQL Server 2005 take a look at Notification Services in the
BOL
One method is
IF EXISTS(SELECT *
FROM TableA
WHERE col = @.key
GROUP BY col
HAVING COUNT(*)>1)
BEGIN
RAISERROR ('There are duplicates in the table',16, 1)
END
ELSE
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||Not really without catching that error in the client code. If you want to do this at the TSQL level:
2000: You can only capture the error number using @.@.ERROR
2005: You can capture almost anything you want, using functions such as ERROR_MESSAGE(),
ERROR_NUMBER(). Do read up on TRY/CATCH if you want to go this route.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||I'm using SQL 2000. Would the query below also work on 2000?
"Uri Dimant" wrote:
> Fred
> If you are on SQL Server 2005 take a look at Notification Services in the
> BOL
>
> One method is
> IF EXISTS(SELECT *
> FROM TableA
> WHERE col = @.key
> GROUP BY col
> HAVING COUNT(*)>1)
> BEGIN
> RAISERROR ('There are duplicates in the table',16, 1)
> END
> ELSE
>
>
> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> > Hi,
> >
> > Is there a way to log errors raised while running a query. For instance a
> > table contains a duplicate entry and a scheduled query notices this. Is it
> > then possible to get an alert in for instance the SQL log?
> >
> > Greets,
> >
> > Fred
>
>|||Fred
Yes
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:AB5685F6-EF5D-4346-A4C0-A8D02D54DDFB@.microsoft.com...
> I'm using SQL 2000. Would the query below also work on 2000?
> "Uri Dimant" wrote:
>> Fred
>> If you are on SQL Server 2005 take a look at Notification Services in the
>> BOL
>>
>> One method is
>> IF EXISTS(SELECT *
>> FROM TableA
>> WHERE col = @.key
>> GROUP BY col
>> HAVING COUNT(*)>1)
>> BEGIN
>> RAISERROR ('There are duplicates in the table',16, 1)
>> END
>> ELSE
>>
>>
>> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
>> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
>> > Hi,
>> >
>> > Is there a way to log errors raised while running a query. For instance
>> > a
>> > table contains a duplicate entry and a scheduled query notices this. Is
>> > it
>> > then possible to get an alert in for instance the SQL log?
>> >
>> > Greets,
>> >
>> > Fred
>>
Logging query errors
Hi,
Is there a way to log errors raised while running a query. For instance a
table contains a duplicate entry and a scheduled query notices this. Is it
then possible to get an alert in for instance the SQL log?
Greets,
FredFred
If you are on SQL Server 2005 take a look at Notification Services in the
BOL
One method is
IF EXISTS(SELECT *
FROM TableA
WHERE col = @.key
GROUP BY col
HAVING COUNT(*)>1)
BEGIN
RAISERROR ('There are duplicates in the table',16, 1)
END
ELSE
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||Not really without catching that error in the client code. If you want to do
this at the TSQL level:
2000: You can only capture the error number using @.@.ERROR
2005: You can capture almost anything you want, using functions such as ERRO
R_MESSAGE(),
ERROR_NUMBER(). Do read up on TRY/CATCH if you want to go this route.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||I'm using SQL 2000. Would the query below also work on 2000?
"Uri Dimant" wrote:
> Fred
> If you are on SQL Server 2005 take a look at Notification Services in the
> BOL
>
> One method is
> IF EXISTS(SELECT *
> FROM TableA
> WHERE col = @.key
> GROUP BY col
> HAVING COUNT(*)>1)
> BEGIN
> RAISERROR ('There are duplicates in the table',16, 1)
> END
> ELSE
>
>
> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
>
>|||Fred
Yes
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:AB5685F6-EF5D-4346-A4C0-A8D02D54DDFB@.microsoft.com...[vbcol=seagreen]
> I'm using SQL 2000. Would the query below also work on 2000?
> "Uri Dimant" wrote:
>
Is there a way to log errors raised while running a query. For instance a
table contains a duplicate entry and a scheduled query notices this. Is it
then possible to get an alert in for instance the SQL log?
Greets,
FredFred
If you are on SQL Server 2005 take a look at Notification Services in the
BOL
One method is
IF EXISTS(SELECT *
FROM TableA
WHERE col = @.key
GROUP BY col
HAVING COUNT(*)>1)
BEGIN
RAISERROR ('There are duplicates in the table',16, 1)
END
ELSE
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||Not really without catching that error in the client code. If you want to do
this at the TSQL level:
2000: You can only capture the error number using @.@.ERROR
2005: You can capture almost anything you want, using functions such as ERRO
R_MESSAGE(),
ERROR_NUMBER(). Do read up on TRY/CATCH if you want to go this route.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
> Hi,
> Is there a way to log errors raised while running a query. For instance a
> table contains a duplicate entry and a scheduled query notices this. Is it
> then possible to get an alert in for instance the SQL log?
> Greets,
> Fred|||I'm using SQL 2000. Would the query below also work on 2000?
"Uri Dimant" wrote:
> Fred
> If you are on SQL Server 2005 take a look at Notification Services in the
> BOL
>
> One method is
> IF EXISTS(SELECT *
> FROM TableA
> WHERE col = @.key
> GROUP BY col
> HAVING COUNT(*)>1)
> BEGIN
> RAISERROR ('There are duplicates in the table',16, 1)
> END
> ELSE
>
>
> "Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
> news:788AA79C-20C2-438B-9556-8AFF574B129B@.microsoft.com...
>
>|||Fred
Yes
"Fred Wouters" <f.wouters@.tigra-tuning.nl> wrote in message
news:AB5685F6-EF5D-4346-A4C0-A8D02D54DDFB@.microsoft.com...[vbcol=seagreen]
> I'm using SQL 2000. Would the query below also work on 2000?
> "Uri Dimant" wrote:
>
Subscribe to:
Posts (Atom)