Thursday, March 22, 2012

Drop User problem in Sql 2005 with agent

Hi
Try put SET ANSI_WARNINGS OFF and see what is going on
"Philip Nelson" <panmanphil@.newsgroup.nospam> wrote in message
news:e2MiQLsmGHA.2204@.TK2MSFTNGP03.phx.gbl...
> In sql 2000 we had a tsql job that ran each day and restored a backup of a
> database to a qa server. Because the backup was of a different user we ran
> a follow up job that dropped one of the sql server users from the database
> and re-added it with a login from the qa system.I updated the syntax to
> use the new drop user commands so it's like
> use [thedatabase]
> go
> DROP USER theUser
> go
> CREATE USER [theUser] FOR LOGIN [theLogin] WITH DEFAULT_SCHEMA=
1;dbo]
> go
> This works perfectly from a management studio window but from the job we
> get the message below. It is the drop user statement that causes the
> error. I have verified that this user does not own any schema's, and the
> error that generates is different anyway. Suggestions?
> Executed as user: PLANADMIN\servsql. String or binary data would be
> truncated. [SQLSTATE 22001] (Error 8152) The statement has been
> terminated. [SQLSTATE 01000] (Error 3621). The step failed.
>
>
>"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ewfz1QsmGHA.3980@.TK2MSFTNGP02.phx.gbl...
> Hi
> Try put SET ANSI_WARNINGS OFF and see what is going on
>
I can see I'm going to learn something today. With that statement added, the
job succeeds. Does that mean that the failure was an erroneous warning?|||In sql 2000 we had a tsql job that ran each day and restored a backup of a
database to a qa server. Because the backup was of a different user we ran a
follow up job that dropped one of the sql server users from the database and
re-added it with a login from the qa system.I updated the syntax to use the
new drop user commands so it's like
use [thedatabase]
go
DROP USER theUser
go
CREATE USER [theUser] FOR LOGIN [theLogin] WITH DEFAULT_SCHEMA=[
dbo]
go
This works perfectly from a management studio window but from the job we get
the message below. It is the drop user statement that causes the error. I
have verified that this user does not own any schema's, and the error that
generates is different anyway. Suggestions?
Executed as user: PLANADMIN\servsql. String or binary data would be
truncated. [SQLSTATE 22001] (Error 8152) The statement has been termina
ted.
[SQLSTATE 01000] (Error 3621). The step failed.|||Hi
Try put SET ANSI_WARNINGS OFF and see what is going on
"Philip Nelson" <panmanphil@.newsgroup.nospam> wrote in message
news:e2MiQLsmGHA.2204@.TK2MSFTNGP03.phx.gbl...
> In sql 2000 we had a tsql job that ran each day and restored a backup of a
> database to a qa server. Because the backup was of a different user we ran
> a follow up job that dropped one of the sql server users from the database
> and re-added it with a login from the qa system.I updated the syntax to
> use the new drop user commands so it's like
> use [thedatabase]
> go
> DROP USER theUser
> go
> CREATE USER [theUser] FOR LOGIN [theLogin] WITH DEFAULT_SCHEMA=
1;dbo]
> go
> This works perfectly from a management studio window but from the job we
> get the message below. It is the drop user statement that causes the
> error. I have verified that this user does not own any schema's, and the
> error that generates is different anyway. Suggestions?
> Executed as user: PLANADMIN\servsql. String or binary data would be
> truncated. [SQLSTATE 22001] (Error 8152) The statement has been
> terminated. [SQLSTATE 01000] (Error 3621). The step failed.
>
>
>|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ewfz1QsmGHA.3980@.TK2MSFTNGP02.phx.gbl...
> Hi
> Try put SET ANSI_WARNINGS OFF and see what is going on
>
I can see I'm going to learn something today. With that statement added, the
job succeeds. Does that mean that the failure was an erroneous warning?

No comments:

Post a Comment