Showing posts with label missing. Show all posts
Showing posts with label missing. Show all posts

Saturday, February 25, 2012

DBs not appearing in query analyer dropdown

A couple of databases on one of our SQL Servers is missing in the db
dropdown in query analyzer.

Does anyone know what I need to update to sync this with the actual
databases?

Thanks,

BurtThe user you are logged in with does not have access to those
databases. There is no "syncing" necessary.

Friday, February 24, 2012

DBO user missing in two databases

SQL 2K on Windows 2003
I know the documentation says that the dbo user account in each database can
't be deleted, but it has gone missing overnight on two databases. This has
caused my SA account to hose since it references the dbo user for these two
db's.
I have failed so far at creating a dbo user account for the sa login. It gi
ves me error 15405:Cannot use the reserved user or role name 'sa'.
I have also not been successful at creating the dbo user account with a diff
erent system administrator login. It gives me the error 15023:user or role
'dbo' already exists in the current database.
I'm stuck and could really use some suggestions.
Thanks in advance,
unsophisticated - small time dba
ShirleyTo change the owner of the databases simply use sp_changedbowner e.g.
use <your db name>
go
exec sp_changedbowner 'sa','true'
go
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
"ShirleyL" <shirleyNoSpamL@.abshernw.com> wrote in message
news:uUSwC1PJFHA.1096@.tk2msftngp13.phx.gbl...
SQL 2K on Windows 2003
I know the documentation says that the dbo user account in each database
can't be deleted, but it has gone missing overnight on two databases. This
has caused my SA account to hose since it references the dbo user for these
two db's.
I have failed so far at creating a dbo user account for the sa login. It
gives me error 15405:Cannot use the reserved user or role name 'sa'.
I have also not been successful at creating the dbo user account with a
different system administrator login. It gives me the error 15023:user or
role 'dbo' already exists in the current database.
I'm stuck and could really use some suggestions.
Thanks in advance,
unsophisticated - small time dba
Shirley|||Jasper Smith wrote:
> To change the owner of the databases simply use sp_changedbowner e.g.
> use <your db name>
> go
> exec sp_changedbowner 'sa','true'
> go
>
There is a small and totally insignificant danger in using sa as a database
owner. When cross database ownership chaining for the database or the server
is activated, and there are non sysadmins in the database with dbo_owner
rights, then the can create stored procedure which access sp's in the master
database like sp_addsrvrolemember.
Hans

Friday, February 17, 2012

DBMONEY

Hi Uri,
That's much better, but still missing the $'s. Apart from hardwiring the $
sign and then concatanating this to the result, any ideas?
What I don't get is the need to cast a column that is already set as money
(pity I didn't use decimal!?) to money, maybe we are missing something
fundamental but isn't this just consuming CPU resource for no apparent reaso
n?
As ex-informix guys we are somewhat puzzled by this and, on a similar point,
all the manipulation one has to undertake for datetime columns when you only
want to use the date portion - presumably something to do with no date
datatype in SQLServer, which is something we find very strange both in the
additional manipulation and also in terms of datastorage?
Slainte,
TaggartOn Sun, 4 Jun 2006 19:53:02 -0700, Taggart wrote:

>Hi Uri,
>That's much better, but still missing the $'s. Apart from hardwiring the $
>sign and then concatanating this to the result, any ideas?
Hi Taggart,
SQL Server is not intended to be used for formatting - that task is
usually handled by the front-end. As a result, SQL Server doesn't have
as much formatting features as some other tools.
If you're sure that your application is only used in dollar-using
countries, hardcoding the $ sign is probably the best solution. If the
app might be used all over the world, you'd be better off letting the
front-end determine the correct currency symbol from the useer's locale
settings and append that symbol to the amount.

>What I don't get is the need to cast a column that is already set as money
>(pity I didn't use decimal!?) to money, maybe we are missing something
>fundamental but isn't this just consuming CPU resource for no apparent reason?[/vbc
ol]
There's no need for the extra CAST - Uri used it becuase the variable he
used in his example was not money. If your column is monmey, you can
just use
SELECT convert(varchar, Column_Name, 1)
[vbcol=seagreen]
>As ex-informix guys we are somewhat puzzled by this and, on a similar point
,
>all the manipulation one has to undertake for datetime columns when you onl
y
>want to use the date portion - presumably something to do with no date
>datatype in SQLServer, which is something we find very strange both in the
>additional manipulation and also in terms of datastorage?
Not having seperate date and time datatypes is indeed a pity.
However, there's no need for much manipulation to remove the time
portion from a datetime column. If you need the result as datetime (only
withoout time portion - or rather, with the default midnight time
portion), use
SELECT DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 0)
And if you need it in character format (for presentation purposes), use
CONVERT with an appropriate style parameter and define the length of the
result such that the time will be cut off, for instance
SELECT CONVERT(char(8), CURRENT_TIMESTAMP, 112)
Hugo Kornelis, SQL Server MVP|||Thanks Hugo your use of convert is much. much neater than my attempt!
"Hugo Kornelis" wrote:

> On Sun, 4 Jun 2006 19:53:02 -0700, Taggart wrote:
>
> Hi Taggart,
> SQL Server is not intended to be used for formatting - that task is
> usually handled by the front-end. As a result, SQL Server doesn't have
> as much formatting features as some other tools.
> If you're sure that your application is only used in dollar-using
> countries, hardcoding the $ sign is probably the best solution. If the
> app might be used all over the world, you'd be better off letting the
> front-end determine the correct currency symbol from the useer's locale
> settings and append that symbol to the amount.
>
> There's no need for the extra CAST - Uri used it becuase the variable he
> used in his example was not money. If your column is monmey, you can
> just use
> SELECT convert(varchar, Column_Name, 1)
>
> Not having seperate date and time datatypes is indeed a pity.
> However, there's no need for much manipulation to remove the time
> portion from a datetime column. If you need the result as datetime (only
> withoout time portion - or rather, with the default midnight time
> portion), use
> SELECT DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 0)
> And if you need it in character format (for presentation purposes), use
> CONVERT with an appropriate style parameter and define the length of the
> result such that the time will be cut off, for instance
> SELECT CONVERT(char(8), CURRENT_TIMESTAMP, 112)
> --
> Hugo Kornelis, SQL Server MVP
>