Showing posts with label remember. Show all posts
Showing posts with label remember. Show all posts

Sunday, March 11, 2012

change value type from Int64 to Int32 ?

I have a query which calculates a number... but by default the number is represented as a 64 bit integer. I cannot remember the function name but it is only using SQL9.0 built in functions. Is there a way to cast the number?

This is not a trivial issue since I have found an easier way to do this which did not involve the number, although any input would be greatly appreciated.

Thank you :)

I don't quite understand your question. But you can cast a value to a different data type using CAST function. You may or may not get runtime errors depending on the data. See Books Online for more details. So in your query, you can do something like below:

select cast(<expr> as int)

from ...

Friday, February 10, 2012

change MSDB owner

My Production's SQL2k MSDB & Model database owner is my old NT Domain
Administrator (olddomain/administrator). Can't remember how it ended that
way. Master owner is SA.
We have completed domain migration to Active Directory, if sp_changedbowner
is not going to allow me to change DB owner for MSDB & Model, does that mean
I got to keep my PDC (NT Domain) forever ?
Surely there must be a work-around for this.
Warning !!!
The following script is not a standard procedure:
[script]
use master
go
exec sp_configure 'allow updates', 1
reconfigure with override
go
update sysdatabases
set sid = 0x01
where name = 'model'
go
sp_configure 'allow updates', 0
reconfigure with override
[/script]
Cristian Lefter, SQL Server MVP
"pohkeat" <pohkeat@.hotmail.com> wrote in message
news:OYIkV$$HFHA.720@.TK2MSFTNGP10.phx.gbl...
> My Production's SQL2k MSDB & Model database owner is my old NT Domain
> Administrator (olddomain/administrator). Can't remember how it ended that
> way. Master owner is SA.
> We have completed domain migration to Active Directory, if
> sp_changedbowner
> is not going to allow me to change DB owner for MSDB & Model, does that
> mean
> I got to keep my PDC (NT Domain) forever ?
> Surely there must be a work-around for this.
>

change MSDB owner

My Production's SQL2k MSDB & Model database owner is my old NT Domain
Administrator (olddomain/administrator). Can't remember how it ended that
way. Master owner is SA.
We have completed domain migration to Active Directory, if sp_changedbowner
is not going to allow me to change DB owner for MSDB & Model, does that mean
I got to keep my PDC (NT Domain) forever ?
Surely there must be a work-around for this.Warning !!!
The following script is not a standard procedure:
[script]
use master
go
exec sp_configure 'allow updates', 1
reconfigure with override
go
update sysdatabases
set sid = 0x01
where name = 'model'
go
sp_configure 'allow updates', 0
reconfigure with override
[/script]
Cristian Lefter, SQL Server MVP
"pohkeat" <pohkeat@.hotmail.com> wrote in message
news:OYIkV$$HFHA.720@.TK2MSFTNGP10.phx.gbl...
> My Production's SQL2k MSDB & Model database owner is my old NT Domain
> Administrator (olddomain/administrator). Can't remember how it ended that
> way. Master owner is SA.
> We have completed domain migration to Active Directory, if
> sp_changedbowner
> is not going to allow me to change DB owner for MSDB & Model, does that
> mean
> I got to keep my PDC (NT Domain) forever ?
> Surely there must be a work-around for this.
>

change MSDB owner

My Production's SQL2k MSDB & Model database owner is my old NT Domain
Administrator (olddomain/administrator). Can't remember how it ended that
way. Master owner is SA.
We have completed domain migration to Active Directory, if sp_changedbowner
is not going to allow me to change DB owner for MSDB & Model, does that mean
I got to keep my PDC (NT Domain) forever ?
Surely there must be a work-around for this.Warning !!!
The following script is not a standard procedure:
[script]
use master
go
exec sp_configure 'allow updates', 1
reconfigure with override
go
update sysdatabases
set sid = 0x01
where name = 'model'
go
sp_configure 'allow updates', 0
reconfigure with override
[/script]
Cristian Lefter, SQL Server MVP
"pohkeat" <pohkeat@.hotmail.com> wrote in message
news:OYIkV$$HFHA.720@.TK2MSFTNGP10.phx.gbl...
> My Production's SQL2k MSDB & Model database owner is my old NT Domain
> Administrator (olddomain/administrator). Can't remember how it ended that
> way. Master owner is SA.
> We have completed domain migration to Active Directory, if
> sp_changedbowner
> is not going to allow me to change DB owner for MSDB & Model, does that
> mean
> I got to keep my PDC (NT Domain) forever ?
> Surely there must be a work-around for this.
>