Thursday, March 29, 2012

Database naming convention

Is there database, tables, columns naming convention that I should follow
when I build some information system proposed from Microsoft?
Thanks in advanced
AdnanThere have been many discussions regarding this.
http://groups-beta.google.com/group...ming+convention
-oj
"Adnan Hebibovic" <adnan.hebibovic@.community.nospam> wrote in message
news:et0c85YFFHA.3732@.tk2msftngp13.phx.gbl...
> Is there database, tables, columns naming convention that I should follow
> when I build some information system proposed from Microsoft?
> Thanks in advanced
> Adnan
>|||Yes I know that oj but i will repeat myselft ... "from Microsoft".
"oj" <nospam_ojngo@.home.com> wrote in message
news:OmBDpEZFFHA.3728@.TK2MSFTNGP14.phx.gbl...
> There have been many discussions regarding this.
> http://groups-beta.google.com/group...ming+convention
>
> --
> -oj
>
> "Adnan Hebibovic" <adnan.hebibovic@.community.nospam> wrote in message
> news:et0c85YFFHA.3732@.tk2msftngp13.phx.gbl...
>|||Look up the ISO-11179 Standards first.
I have a new book, SQL PROGRAMMING STYLE, due out the middle of this
year that deals with this topic.
I bothered to research readability, typography, industry standards,
etc. I also get into some common design flaws, heuristics, software
metrics, etc.
I am hoping that people will pick it up and use it as a guide in their
shops. Even if they don't like it, they will have a single set of
rules. And they can yell at me :)|||Thanks
"--CELKO--" <jcelko212@.earthlink.net> wrote in message
news:1108827223.033936.154350@.o13g2000cwo.googlegroups.com...
> Look up the ISO-11179 Standards first.
> I have a new book, SQL PROGRAMMING STYLE, due out the middle of this
> year that deals with this topic.
> I bothered to research readability, typography, industry standards,
> etc. I also get into some common design flaws, heuristics, software
> metrics, etc.
> I am hoping that people will pick it up and use it as a guide in their
> shops. Even if they don't like it, they will have a single set of
> rules. And they can yell at me :)
>sql

Database Naming

am doing some testing on a database created by the programming dept of the
company, they named the database '123v10'.
When I run some queries (mostly admin stuff, checking the fragmentation,
space used by the data and log files, etc) in the Query Analyzer, I often
get the error message:
Line 1: Incorrect syntax near '123'.
My guess is that SQL doesn't particularly like database names that start
with numbers, am I correct? If so, will this create any real problems down
the line? I think we are at an early enough stage that the database could
be renamed if this would help.
TIA,
Nancy L> My guess is that SQL doesn't particularly like database names that start
> with numbers, am I correct? If so, will this create any real problems
> down
> the line? I think we are at an early enough stage that the database could
> be renamed if this would help.
Yes, you are correct. However, it should not cause problems if you code
defensively (which you should be doing anyways). The problem is that the
creator of the name did not follow the rules for regular identifiers. If
you don't follow the rules, then you must take extra steps to properly
delimit the identifier name (this includes all object names - databases,
triggers, procedures, tables, etc.). Obviously, the easiest approach is to
follow the rules.|||"Scott Morris" <bogus@.bogus.com> wrote in message
news:eUt9vPN$FHA.360@.TK2MSFTNGP09.phx.gbl...
> Yes, you are correct. However, it should not cause problems if you code
> defensively (which you should be doing anyways). The problem is that the
> creator of the name did not follow the rules for regular identifiers. If
> you don't follow the rules, then you must take extra steps to properly
> delimit the identifier name (this includes all object names - databases,
> triggers, procedures, tables, etc.). Obviously, the easiest approach is
> to follow the rules.
>
To add to that. Ensure that you use square brackets [ ] whenever you
reference the db name.
Rick Sawtell|||You may get it to work by using brackets around the db name like [123xxx],
however, somewhere down the road there will perhaps be a query or
application that will choke on it. It would be best to nip it in the bud
now.
"Nancy Lytle" <word_diva@.hotmail.com> wrote in message
news:O0YWoDN$FHA.216@.TK2MSFTNGP15.phx.gbl...
> am doing some testing on a database created by the programming dept of the
> company, they named the database '123v10'.
> When I run some queries (mostly admin stuff, checking the fragmentation,
> space used by the data and log files, etc) in the Query Analyzer, I often
> get the error message:
> Line 1: Incorrect syntax near '123'.
> My guess is that SQL doesn't particularly like database names that start
> with numbers, am I correct? If so, will this create any real problems
> down
> the line? I think we are at an early enough stage that the database could
> be renamed if this would help.
> TIA,
> Nancy L
>

database naming

Hello Group,
where does it talk about naming databases in the books online? I thought
that a database name could not have a dash "-" in the name?
Rich
The topic is "Identifiers"
http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
section "Rules for Regular Identifiers".
The only way you can includ special characters like a dash is to delimit the
name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
details.
-- This fails
create database my-database
-- This works
create database [my-database]
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
> Hello Group,
> where does it talk about naming databases in the books online? I thought
> that a database name could not have a dash "-" in the name?
> Rich
|||Hello Gail,
here is the command I am running in the QA:
backup log intrel-dev with truncate_only
and the error I get:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '-'.
I suspect that the database name cannot have the dash in it.
Rich
"Gail Erickson [MS]" wrote:

> The topic is "Identifiers"
> http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
> section "Rules for Regular Identifiers".
> The only way you can includ special characters like a dash is to delimit the
> name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
> details.
> -- This fails
> create database my-database
> -- This works
> create database [my-database]
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
>
>
|||Did you try delimiting the name with [ ] or qoutes? As in, backup log
[intrel-dev] with truncate_only
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:059836F7-2E73-4340-BC3C-3FE3E4B3AC7D@.microsoft.com...[vbcol=seagreen]
> Hello Gail,
> here is the command I am running in the QA:
> backup log intrel-dev with truncate_only
> and the error I get:
> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near '-'.
> I suspect that the database name cannot have the dash in it.
> Rich
> "Gail Erickson [MS]" wrote:

database naming

Hello Group,
where does it talk about naming databases in the books online? I thought
that a database name could not have a dash "-" in the name?
RichThe topic is "Identifiers"
http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
section "Rules for Regular Identifiers".
The only way you can includ special characters like a dash is to delimit the
name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
details.
-- This fails
create database my-database
-- This works
create database [my-database]
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
> Hello Group,
> where does it talk about naming databases in the books online? I thought
> that a database name could not have a dash "-" in the name?
> Rich|||Hello Gail,
here is the command I am running in the QA:
backup log intrel-dev with truncate_only
and the error I get:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '-'.
I suspect that the database name cannot have the dash in it.
Rich
"Gail Erickson [MS]" wrote:

> The topic is "Identifiers"
> http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
> section "Rules for Regular Identifiers".
> The only way you can includ special characters like a dash is to delimit t
he
> name with [ ] or qoutes. See the topic "Delimited Identifiers" for mo
re
> details.
> -- This fails
> create database my-database
> -- This works
> create database [my-database]
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
>
>|||Did you try delimiting the name with [ ] or qoutes? As in, backup log
[intrel-dev] with truncate_only
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:059836F7-2E73-4340-BC3C-3FE3E4B3AC7D@.microsoft.com...[vbcol=seagreen]
> Hello Gail,
> here is the command I am running in the QA:
> backup log intrel-dev with truncate_only
> and the error I get:
> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near '-'.
> I suspect that the database name cannot have the dash in it.
> Rich
> "Gail Erickson [MS]" wrote:
>

database naming

Hello Group,
where does it talk about naming databases in the books online? I thought
that a database name could not have a dash "-" in the name?
RichThe topic is "Identifiers"
http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
section "Rules for Regular Identifiers".
The only way you can includ special characters like a dash is to delimit the
name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
details.
-- This fails
create database my-database
-- This works
create database [my-database]
--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
> Hello Group,
> where does it talk about naming databases in the books online? I thought
> that a database name could not have a dash "-" in the name?
> Rich|||Hello Gail,
here is the command I am running in the QA:
backup log intrel-dev with truncate_only
and the error I get:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '-'.
I suspect that the database name cannot have the dash in it.
Rich
"Gail Erickson [MS]" wrote:
> The topic is "Identifiers"
> http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
> section "Rules for Regular Identifiers".
> The only way you can includ special characters like a dash is to delimit the
> name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
> details.
> -- This fails
> create database my-database
> -- This works
> create database [my-database]
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
> > Hello Group,
> >
> > where does it talk about naming databases in the books online? I thought
> > that a database name could not have a dash "-" in the name?
> >
> > Rich
>
>|||Did you try delimiting the name with [ ] or qoutes? As in, backup log
[intrel-dev] with truncate_only
--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:059836F7-2E73-4340-BC3C-3FE3E4B3AC7D@.microsoft.com...
> Hello Gail,
> here is the command I am running in the QA:
> backup log intrel-dev with truncate_only
> and the error I get:
> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near '-'.
> I suspect that the database name cannot have the dash in it.
> Rich
> "Gail Erickson [MS]" wrote:
>> The topic is "Identifiers"
>> http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
>> section "Rules for Regular Identifiers".
>> The only way you can includ special characters like a dash is to delimit
>> the
>> name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
>> details.
>> -- This fails
>> create database my-database
>> -- This works
>> create database [my-database]
>> --
>> Gail Erickson [MS]
>> SQL Server Documentation Team
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights
>> "Rich" <Rich@.discussions.microsoft.com> wrote in message
>> news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
>> > Hello Group,
>> >
>> > where does it talk about naming databases in the books online? I
>> > thought
>> > that a database name could not have a dash "-" in the name?
>> >
>> > Rich
>>

Database Names

Hi Everyone,
I've got Windows SharePoint Services installed and it uses a database called
STS_svr-apps-1_1414639615
I'm trying to back up this database from the QSQL command line tool.
However when I try to run the backup, I get the following error:
1> BACKUP DATABASE STS_svr-apps-1_1414639615 TO DISK
'D:\ShareBack\Backup.bak'
2> GO
Msg 170, Level 15, State 1, Server SVR-APPS-1\SHAREPOINT, Line 1
Line 1: Incorrect syntax near '-'.
1>
Thinking it might be an issue with the name I enclosed it in single quotes:
1> BACKUP DATABASE 'STS_svr-apps-1_1414639615' TO DISK
'D:\ShareBack\Backup.bak'
2> GO
Msg 170, Level 15, State 1, Server SVR-APPS-1\SHAREPOINT, Line 1
Line 1: Incorrect syntax near 'STS_svr-apps-1_1414639615'.
1>
Yet I still get the same error!
Then I tried to just use the database:
1> use STS_svr-apps-1_1414639615
2> go
Msg 911, Level 16, State 1, Server SVR-APPS-1\SHAREPOINT, Line 1
Could not locate entry in sysdatabases for database 'STS_svr'. No entry
found
with that name. Make sure that the name is entered correctly.
1>
Again I tried to using quotation marks, another error:
1> use 'STS_svr-apps-1_1414639615'
2> GO
Msg 170, Level 15, State 1, Server SVR-APPS-1\SHAREPOINT, Line 1
Line 1: Incorrect syntax near 'STS_svr-apps-1_1414639615'.
1> quit
If I do:
SELECT name
FROM master..sysdatabases
ORDER BY name
It lists:
master
model
msdb
STS_Config
STS_svr-apps-1_1414639615
tempdb
From this I can only assume MSDE doesn't support having '-' in a database
name?
Can someone suggest a way around this?
Thanks
Chris Moon
hi Chris,
> From this I can only assume MSDE doesn't support having '-' in a
> database name?
>
SQL Server (and MSDE) support this kind of identifier.. executing
SET NOCOUNT ON
SELECT @.@.VERSION
GO
CREATE DATABASE [STS_svr-apps-1_1414639615];
GO
USE [STS_svr-apps-1_1414639615];
GO
USE master ;
GO
DROP DATABASE [STS_svr-apps-1_1414639615];
reports
Microsoft SQL Server 2000 - 8.00.2162 (Intel X86)
Sep 30 2005 19:59:14
Copyright (c) 1988-2003 Microsoft Corporation
Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 2)
The CREATE DATABASE process is allocating 0.75 MB on disk
'STS_svr-apps-1_1414639615'.
The CREATE DATABASE process is allocating 0.49 MB on disk
'STS_svr-apps-1_1414639615_log'.
Deleting database file 'C:\Programmi\Microsoft SQL
Server\MSSQL$MSDE2K\Data\STS_svr-apps-1_1414639615_log.LDF'.
Deleting database file 'C:\Programmi\Microsoft SQL
Server\MSSQL$MSDE2K\Data\STS_svr-apps-1_1414639615.mdf'.
http://msdn.microsoft.com/library/de...on_03_6e9e.asp
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Many thanks Andrea, it worked perfectly.
Thanks again.
Chris Moon
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:43ml8mF1o772rU1@.individual.net...
> hi Chris,
> SQL Server (and MSDE) support this kind of identifier.. executing
> SET NOCOUNT ON
> SELECT @.@.VERSION
> GO
> CREATE DATABASE [STS_svr-apps-1_1414639615];
> GO
> USE [STS_svr-apps-1_1414639615];
> GO
> USE master ;
> GO
> DROP DATABASE [STS_svr-apps-1_1414639615];
> reports
> ----
> Microsoft SQL Server 2000 - 8.00.2162 (Intel X86)
> Sep 30 2005 19:59:14
> Copyright (c) 1988-2003 Microsoft Corporation
> Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 2)
> The CREATE DATABASE process is allocating 0.75 MB on disk
> 'STS_svr-apps-1_1414639615'.
> The CREATE DATABASE process is allocating 0.49 MB on disk
> 'STS_svr-apps-1_1414639615_log'.
> Deleting database file 'C:\Programmi\Microsoft SQL
> Server\MSSQL$MSDE2K\Data\STS_svr-apps-1_1414639615_log.LDF'.
> Deleting database file 'C:\Programmi\Microsoft SQL
> Server\MSSQL$MSDE2K\Data\STS_svr-apps-1_1414639615.mdf'.
> http://msdn.microsoft.com/library/de...on_03_6e9e.asp
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
sql

Database name with point in it (mail.archive.mdf) not recognised in query analyser of SQL

Apparently the query analyser of sql server does not recognise a
database with a point in it, like
mail.archive.mdf

I receive the following error when I use it:

Server: Msg 911, Level 16, State 1, Line 1
Could not locate entry in sysdatabases for database 'mail'. No entry
found with that name. Make sure that the name is entered correctly.

Please help, thanks
Premselect * from master..sysdatabases
where name ='mail.archive'

mdf is not part of the name

Denis the SQL Menace
http://sqlservercode.blogspot.com/

Prem wrote:
> Apparently the query analyser of sql server does not recognise a
> database with a point in it, like
> mail.archive.mdf
> I receive the following error when I use it:
> Server: Msg 911, Level 16, State 1, Line 1
> Could not locate entry in sysdatabases for database 'mail'. No entry
> found with that name. Make sure that the name is entered correctly.
> Please help, thanks
> Prem|||Prem (premmetje@.zonnet.nl) writes:
> Apparently the query analyser of sql server does not recognise a
> database with a point in it, like
> mail.archive.mdf
> I receive the following error when I use it:
> Server: Msg 911, Level 16, State 1, Line 1
> Could not locate entry in sysdatabases for database 'mail'. No entry
> found with that name. Make sure that the name is entered correctly.

Need to use brackets or double quotes for identifiers with characters
that are not identifier characters normally:

USE [mail.archive.mdf]

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

DATABASE NAME SHOWS MY USERNAME

I am not so familiar with SQL Server 2005, but the problem is that when i created a vies and try to save it, instead of the name starting with the dbo. prefix, its starting with my username.

And i just found out that this is not happening only in the view its happening where ever i created an object and try to save it.

How can i change this from my username to make it display dbo. instead.

I think this is why i'm getting permission error when i try to use DTS package.

IF you want the dbo schema to 'own' the object (VIEW, TABLE, etc.) then use 'dbo.' as part of the name when you create the object.

CREATE VIEW dbo.MyView

AS ...

In order to correct the existing 'mis-named' objects, you will have to 'transfer' them into the correct schema.

ALTER SCHEMA dbo TRANSFER YourName.MyView

When that is complete, each item will then be in the [dbo] schema, and can be used by all users of the database, and referred to as dbo.MyView, dbo.MyFunction, dbo.MyTable, etc..

|||

Thanks for the reply

We dont create them coding. This has to do with Cranberry, so when we create rules, we use them in cranberry.

The way we create a view is just to right click on the View, select new rule. Then after adding table and doing all modification then we click the save button. A box pop showing View1 that is what we change to the new name we want to use then after i save and went back to the view list, i see that it has added my username as a prefix instead of dbo.

So its not that I'm coding anything manualy, so i dont know where to put all the codes above.

Thanks.

N.B. Sorry, this is my 1st time using SQL.

|||

Add the 'dbo.' to the name when you name the view.

For the existing 'mis-named' views, if you can't execute the code I presented previously, you will have to delete the existing views and re-create them and use the correct names (including the prefix).

|||

Hi Arnie,

When i created another view and add the 'dbo.' to the name, it gave an error message

"Invalid Indentifier dbo.tr_XXXX_XXX_XxxXxx"

Thanks.

|||

Hi Kaybal,

Modify the user that your application uses to have default schema of dbo. and make sure your user account has permissions on the dbo schema.

try this and let us know how you got on.

regards

Jag

|||

Hi Jag,

Thanks for the reply, can you put through how to modify the user and have default schema of dbo. Where do i go or what link should i use

thanks

|||

Hi Kaybal,

here you go. Let us know how you got on.

USE database_name; ALTER USER user_name WITH DEFAULT_SCHEMA = dbo; GO

regards

Jag

Database Name problem

I have a database server and I have other web server. I want to connect to Microsoft SQL server I connected. My database name has " " space in it line
"My Database" I use php to connect to MSSQL but php dosent see or understand space in Database name... I cant change database name because other sites also uses this database. How can solve this prblem pls help me.Put the database name in brackets. [My Database]

Database name not found in the Edit job step in SQL Server Enterprise Manager

Hi,

I need help. I transferred my database from one server to another by
using attach detach process.I created all the jobs which existed in the

old server in the new server. Everything looked fine but a couple of
jobs is a giving me some problems. When I try to edit the job step I
could see that the database dropdown list doesn't contain the database
name(which I transferred from the old server)

Does anyone have any idea about it.

Thanks
Arun(arunkumar_m2001@.yahoo.com) writes:
> I need help. I transferred my database from one server to another by
> using attach detach process.I created all the jobs which existed in the
> old server in the new server. Everything looked fine but a couple of
> jobs is a giving me some problems. When I try to edit the job step I
> could see that the database dropdown list doesn't contain the database
> name(which I transferred from the old server)
>
> Does anyone have any idea about it.

Have you tried simply closing down Enterprise Manager and starting it
again? I did a quick test, and it appears that the job-step dialogue
caches the database list, so it may not have seen the new database yet.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

database name issue

Any known problem or in future a problem in using database name with a space
in it.
Example "North Wind" or "MY DB"If you use a space in the name you must enclose all references to it in
square braces... ie [my db]... I prefer NOT to name dbs this way.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"ilovesql" <ilovesql@.hotmail.com> wrote in message
news:O$kMq1zlDHA.1672@.TK2MSFTNGP09.phx.gbl...
> Any known problem or in future a problem in using database name with a
space
> in it.
> Example "North Wind" or "MY DB"
>|||By the way... If you include spaces, you may run into software that does NOT
use square braces, which means the software would not work against your db.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"ilovesql" <ilovesql@.hotmail.com> wrote in message
news:O$kMq1zlDHA.1672@.TK2MSFTNGP09.phx.gbl...
> Any known problem or in future a problem in using database name with a
space
> in it.
> Example "North Wind" or "MY DB"
>sql

Database name is a corrupt file - Veritas Backupexec

I am getting this message while backing up database using
Veritas Software. I need to find what causing this problem.
Thanks,
Mukul Agochiya
magochiya@.hotmail.comThis is the exact wording of error
Operating system error 995(The I/O operation has been
aborted because of either a thre4ad exit or an application
request.)
>--Original Message--
>I am getting this message while backing up database using
>Veritas Software. I need to find what causing this
problem.
>Thanks,
>Mukul Agochiya
>magochiya@.hotmail.com
>.
>|||don't use BE to backup DBs. Backup DBs to files using SQL native tools and
use BE to backup those files to tapes.
"Mukul Agochiya" <magochiya@.hotmail.com> wrote in message
news:13ac01c39258$1667e1f0$a101280a@.phx.gbl...
> I am getting this message while backing up database using
> Veritas Software. I need to find what causing this problem.
> Thanks,
> Mukul Agochiya
> magochiya@.hotmail.com

database name in SQL Server 2000

I'd like to create a trigger on a SQL Server 2000 table that operates if the table is in a particular database, but not in others. How do I query for the database name?

Thanks.

DB_NAME() will give you the database name but since you create a trigger on tables I don't see how this is usefull?

when you create a trigger on table abc you have to be in a DB already so you already know the name on creation

Denis the SQL Menace

http://sqlservercode.blogspot.com/

Database Name Environment Variable

Is there any environment variable that tells me what database I'm in on SQL
2000?
TIA,
CJSELECT DB_NAME()
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> Is there any environment variable that tells me what database I'm in on
SQL
> 2000?
> TIA,
> CJ
>|||Much appreciated.
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23y%23S6fSsEHA.2632@.TK2MSFTNGP10.phx.gbl...
> SELECT DB_NAME()
>
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> > Is there any environment variable that tells me what database I'm in on
> SQL
> > 2000?
> >
> > TIA,
> > CJ
> >
> >
>|||Apologies for the multi post, realized after the fact it may be more of a
.programming question rather than a .server question.
Again, sorry.
-CJ
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23y%23S6fSsEHA.2632@.TK2MSFTNGP10.phx.gbl...
> SELECT DB_NAME()
>
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> > Is there any environment variable that tells me what database I'm in on
> SQL
> > 2000?
> >
> > TIA,
> > CJ
> >
> >
>

Database Name Environment Variable

Is there any environment variable that tells me what database I'm in on SQL
2000?
TIA,
CJ
SELECT DB_NAME()
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> Is there any environment variable that tells me what database I'm in on
SQL
> 2000?
> TIA,
> CJ
>
|||Much appreciated.
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23y%23S6fSsEHA.2632@.TK2MSFTNGP10.phx.gbl...
> SELECT DB_NAME()
>
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> SQL
>
|||Apologies for the multi post, realized after the fact it may be more of a
..programming question rather than a .server question.
Again, sorry.
-CJ
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23y%23S6fSsEHA.2632@.TK2MSFTNGP10.phx.gbl...
> SELECT DB_NAME()
>
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> SQL
>

Database Name Environment Variable

Is there any environment variable that tells me what database I'm in on SQL
2000?
TIA,
CJSELECT DB_NAME()
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> Is there any environment variable that tells me what database I'm in on
SQL
> 2000?
> TIA,
> CJ
>|||Much appreciated.
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23y%23S6fSsEHA.2632@.TK2MSFTNGP10.phx.gbl...
> SELECT DB_NAME()
>
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> SQL
>|||Apologies for the multi post, realized after the fact it may be more of a
.programming question rather than a .server question.
Again, sorry.
-CJ
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23y%23S6fSsEHA.2632@.TK2MSFTNGP10.phx.gbl...
> SELECT DB_NAME()
>
> "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
> news:O%23n%234WSsEHA.2252@.TK2MSFTNGP11.phx.gbl...
> SQL
>sql

database name changing

I would like to change database name but also to change database data file name and log file name.
Any suggestions?
Changing only name is not a problem.
Thanks
Przemo
Hi
Take a look at ALTER DATABASE command on BOL
Why do you want to change a phsycal file name?
create database test
go
sp_detach_db test (Change now the name of files)
go
sp_attach_db test,
@.filename1 = N'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\test1.mdf',
@.filename2 = N'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\test_log1.ldf'
"Przemo" <anonymous@.discussions.microsoft.com> wrote in message
news:95FB2D1B-C881-4382-ADDF-D927F99D7FC0@.microsoft.com...
> I would like to change database name but also to change database data file
name and log file name.
> Any suggestions?
> Changing only name is not a problem.
> Thanks
> Przemo
|||Hi,
Database Name change
1. Remove all the users connected to the database
alter database <dbname> set single_user with rollback immediate
2. Run the below command to rename the database
alter database <current_db_name> modify name=<new_db_name>
You can replace the step-2 with sp_renamedb system stored Procedure.
Data and Log file name change
1. Detach the database using SP_DETACH_DB
2. Rename the physical files
3. Attach back the files using SP_ATTACH_DB with new physical file names.
Thanks
Hari
MCDBA
"Przemo" <anonymous@.discussions.microsoft.com> wrote in message
news:95FB2D1B-C881-4382-ADDF-D927F99D7FC0@.microsoft.com...
> I would like to change database name but also to change database data file
name and log file name.
> Any suggestions?
> Changing only name is not a problem.
> Thanks
> Przemo
|||Przemo
It is pretty simple
1. Using the GUI you can detach the DB. (Make sure you have a backup first)
2. Then go to the file location and rename the files
3. Then Using the GUI again you can attach the DB. It will automattically show the old file names and path. Change the path names to match the new naming and rename the DB and you are done.
Jeff Duncan
MCDBA, MCSE+I

database name changing

I would like to change database name but also to change database data file n
ame and log file name.
Any suggestions?
Changing only name is not a problem.
Thanks
PrzemoHi
Take a look at ALTER DATABASE command on BOL
Why do you want to change a phsycal file name?
create database test
go
sp_detach_db test (Change now the name of files)
go
sp_attach_db test,
@.filename1 = N'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\test1.mdf',
@.filename2 = N'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\test_log1.ldf'
"Przemo" <anonymous@.discussions.microsoft.com> wrote in message
news:95FB2D1B-C881-4382-ADDF-D927F99D7FC0@.microsoft.com...
> I would like to change database name but also to change database data file
name and log file name.
> Any suggestions?
> Changing only name is not a problem.
> Thanks
> Przemo|||Hi,
Database Name change
--
1. Remove all the users connected to the database
alter database <dbname> set single_user with rollback immediate
2. Run the below command to rename the database
alter database <current_db_name> modify name=<new_db_name>
You can replace the step-2 with sp_renamedb system stored Procedure.
Data and Log file name change
--
1. Detach the database using SP_DETACH_DB
2. Rename the physical files
3. Attach back the files using SP_ATTACH_DB with new physical file names.
Thanks
Hari
MCDBA
"Przemo" <anonymous@.discussions.microsoft.com> wrote in message
news:95FB2D1B-C881-4382-ADDF-D927F99D7FC0@.microsoft.com...
> I would like to change database name but also to change database data file
name and log file name.
> Any suggestions?
> Changing only name is not a problem.
> Thanks
> Przemo|||Przemo
It is pretty simple
1. Using the GUI you can detach the DB. (Make sure you have a backup first
)
2. Then go to the file location and rename the files
3. Then Using the GUI again you can attach the DB. It will automattically
show the old file names and path. Change the path names to match the new na
ming and rename the DB and you are done.
Jeff Duncan
MCDBA, MCSE+I

database name changing

I would like to change database name but also to change database data file name and log file name
Any suggestions
Changing only name is not a problem
Thank
PrzemoHi
Take a look at ALTER DATABASE command on BOL
Why do you want to change a phsycal file name?
create database test
go
sp_detach_db test (Change now the name of files)
go
sp_attach_db test,
@.filename1 = N'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\test1.mdf',
@.filename2 = N'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\test_log1.ldf'
"Przemo" <anonymous@.discussions.microsoft.com> wrote in message
news:95FB2D1B-C881-4382-ADDF-D927F99D7FC0@.microsoft.com...
> I would like to change database name but also to change database data file
name and log file name.
> Any suggestions?
> Changing only name is not a problem.
> Thanks
> Przemo|||Hi,
Database Name change
--
1. Remove all the users connected to the database
alter database <dbname> set single_user with rollback immediate
2. Run the below command to rename the database
alter database <current_db_name> modify name=<new_db_name>
You can replace the step-2 with sp_renamedb system stored Procedure.
Data and Log file name change
--
1. Detach the database using SP_DETACH_DB
2. Rename the physical files
3. Attach back the files using SP_ATTACH_DB with new physical file names.
Thanks
Hari
MCDBA
"Przemo" <anonymous@.discussions.microsoft.com> wrote in message
news:95FB2D1B-C881-4382-ADDF-D927F99D7FC0@.microsoft.com...
> I would like to change database name but also to change database data file
name and log file name.
> Any suggestions?
> Changing only name is not a problem.
> Thanks
> Przemo

Database Name as a Parameter

Hello folks,

I am in the process of writing a stored proc that selects data from a set of tables. Since this procedure needs to run in multiple databases, I wanted to store database names in a table and have the proc. retrieve the names dynamically.

In short, I want to execute the following stt:
select 'Conversion 1,
'Query 1',
(select count(*) from @.testDB.student)

(in this case @.testDB could be "parul1.dbo" or "parul2.dbo" etc.

How can this functionality be achieved through dynamic SQL?

Thanks so much!
-Paruldeclare @.sql nvarchar(1000),@.testDB varchar(100)
set @.testDB='parul1'
set @.sql='select ''Conversion 1'',''Query 1'',count(*) from '+@.testDB+'.dbo.student'

print @.sql

exec sp_executesql @.sql|||Thanks, that worked!
I have another question - how can i put the results from "EXEC sp_executesql @.SQLSTRING" into a temp table?

How can I get this to work?
Insert #temp1
select @.stage,
'Query 1',
@.sqlStringQuery1,
EXEC sp_executesql @.sqlStringQuery1

Thanks so much!

-Parul|||create a procedure which takes in DB name as parameter...do the select and the insert inside the procedure.|||Thanks, do you have sample code?|||Insert JUST the EXEC into a temp table first. Then, insert into a second temp table the results of that table joined to whatever else you need to insert.

database name

Is there a way to determine the current database the session is using? I want
to use this to determine if a script should proceed. It should only proceed
if the current database is not a system database.
I was thinking something like,
IF (select dbid < 6) THEN RAISERROR.
Thoughts? Thanks!
Check books online for db_name.
If you execute something like:
select db_name()
you will get the current database name.
-Sue
On Mon, 13 Sep 2004 16:41:12 -0700, "Bevo"
<Bevo@.discussions.microsoft.com> wrote:

>Is there a way to determine the current database the session is using? I want
>to use this to determine if a script should proceed. It should only proceed
>if the current database is not a system database.
>I was thinking something like,
>IF (select dbid < 6) THEN RAISERROR.
>Thoughts? Thanks!
|||if ( db_name != 'mydb') Raiserror ('Incorrect database',16,1)
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Bevo" <Bevo@.discussions.microsoft.com> wrote in message
news:4A5919FA-B5A6-4B2E-BF05-F681FBA08019@.microsoft.com...
> Is there a way to determine the current database the session is using? I
want
> to use this to determine if a script should proceed. It should only
proceed
> if the current database is not a system database.
> I was thinking something like,
> IF (select dbid < 6) THEN RAISERROR.
> Thoughts? Thanks!
|||I will not know the name of the database to be used, but I will know that it
is not a system database.
Can I be sure that all database ids greater than 6 are not system databases?
If so, the logic would be this:
if ( db_id(db_name()) < 6) Raiserror ('Must not be a system database',16,1)
"Wayne Snyder" wrote:

> if ( db_name != 'mydb') Raiserror ('Incorrect database',16,1)
>
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Bevo" <Bevo@.discussions.microsoft.com> wrote in message
> news:4A5919FA-B5A6-4B2E-BF05-F681FBA08019@.microsoft.com...
> want
> proceed
>
>
|||There is no need for db_name().
e.g.
If (db_id()<6) Raiserror ('Must not be a system included database',16,1)
Howerver, it's best to be explicit because you would never know if there
would be more than 6 system included databases. Plus, the db_id for the 7th
might be >6. Thus,
If (db_name() in ('master','msdb','tempdb','model','Northwind','Pub s'))
Raiserror ('Must not be a system included database',16,1)
"Bevo" <Bevo@.discussions.microsoft.com> wrote in message
news:10284D82-E541-46F4-B3C3-C76AA021BA40@.microsoft.com...
> I will not know the name of the database to be used, but I will know that
it
> is not a system database.
> Can I be sure that all database ids greater than 6 are not system
databases?
> If so, the logic would be this:
> if ( db_id(db_name()) < 6) Raiserror ('Must not be a system
database',16,1)[vbcol=seagreen]
>
sql

Database Name

Can you have Databse names that contain spaces such as Intanet Content
Databse? Will this cause any issues in SQL 2000?
You can, but you need to delimit the names with brackets:
[Intanet Content Databse]
In my opinion it's not a good practice. Do the spaces really add anything
extra to the name? Furthermore, why do you need to add the "Database" (or
"Databse" in your case) identifier? Do your client tools merge databases
and other types of objects in the same views, such that you need the
additional text to differentiate between them in a list?
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
> Can you have Databse names that contain spaces such as Intanet Content
> Databse? Will this cause any issues in SQL 2000?
|||Its froma Admin. stanpoint. These databses are created my Sharepoitn
Services. I'm assuming the brackets are required when I reference them. I
don't actual name them [Intanet Databse] do I?
"Adam Machanic" wrote:

> You can, but you need to delimit the names with brackets:
> [Intanet Content Databse]
> In my opinion it's not a good practice. Do the spaces really add anything
> extra to the name? Furthermore, why do you need to add the "Database" (or
> "Databse" in your case) identifier? Do your client tools merge databases
> and other types of objects in the same views, such that you need the
> additional text to differentiate between them in a list?
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
>
>
|||Brackets are required both when creating them and when referencing them. I
assume Sharepoint does that automatically for you...
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...[vbcol=seagreen]
> Its froma Admin. stanpoint. These databses are created my Sharepoitn
> Services. I'm assuming the brackets are required when I reference them.
> I
> don't actual name them [Intanet Databse] do I?
> "Adam Machanic" wrote:
|||And you can also use double-quotes, "Intanet Databse", which is the ANSI SQL way to delimit
identifiers.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
> Brackets are required both when creating them and when referencing them. I assume Sharepoint does
> that automatically for you...
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...
>
|||Sharepoint doesn't create it with Brackets. It shows up in EM as Inranet
Company Content.
"Tibor Karaszi" wrote:

> And you can also use double-quotes, "Intanet Databse", which is the ANSI SQL way to delimit
> identifiers.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
>
|||The brackets (or double-quotes) are used when referencing the database.
They are not part of the string -- just there to delimit it.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:A782969A-728B-44E5-98C2-8BB105BFC421@.microsoft.com...[vbcol=seagreen]
> Sharepoint doesn't create it with Brackets. It shows up in EM as Inranet
> Company Content.
> "Tibor Karaszi" wrote:

database name

When using query analyzer i need to know what database the scripts is
running on and store that name into a variable. is there a global database
name variable? I know about @.@.servername but no @.@.databasename :(DB_NAME()
David Portas
SQL Server MVP
--
"eg" <emil@.dbworks.com> wrote in message
news:u$CXluRnFHA.3960@.TK2MSFTNGP12.phx.gbl...
> When using query analyzer i need to know what database the scripts is
> running on and store that name into a variable. is there a global database
> name variable? I know about @.@.servername but no @.@.databasename :(
>|||select db_name()
"eg" wrote:

> When using query analyzer i need to know what database the scripts is
> running on and store that name into a variable. is there a global database
> name variable? I know about @.@.servername but no @.@.databasename :(
>
>|||ty
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:roqdnX7ixsVdlGTfRVn-1A@.giganews.com...
> DB_NAME()
> --
> David Portas
> SQL Server MVP
> --
> "eg" <emil@.dbworks.com> wrote in message
> news:u$CXluRnFHA.3960@.TK2MSFTNGP12.phx.gbl...
>

Database name

First let me apologize...I am using SSRS 2000 and I haven't worked in
it in 2 years so I'm having trouble with some very elementary stuff.
I need to get the database name in a footer. Any help would be
greatly appreciated!
ReneeUse a dataset with the following: select db_name()
Then in the footer put a textbox and an expression. The expression will use
First (there is only one record so this works).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"beener" <rmp_colo@.hotmail.com> wrote in message
news:1188319538.901307.242230@.50g2000hsm.googlegroups.com...
> First let me apologize...I am using SSRS 2000 and I haven't worked in
> it in 2 years so I'm having trouble with some very elementary stuff.
> I need to get the database name in a footer. Any help would be
> greatly appreciated!
> Renee
>

Database Name

Can you have Databse names that contain spaces such as Intanet Content
Databse? Will this cause any issues in SQL 2000?You can, but you need to delimit the names with brackets:
[Intanet Content Databse]
In my opinion it's not a good practice. Do the spaces really add anything
extra to the name? Furthermore, why do you need to add the "Database" (or
"Databse" in your case) identifier? Do your client tools merge databases
and other types of objects in the same views, such that you need the
additional text to differentiate between them in a list?
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
> Can you have Databse names that contain spaces such as Intanet Content
> Databse? Will this cause any issues in SQL 2000?|||Its froma Admin. stanpoint. These databses are created my Sharepoitn
Services. I'm assuming the brackets are required when I reference them. I
don't actual name them [Intanet Databse] do I?
"Adam Machanic" wrote:

> You can, but you need to delimit the names with brackets:
> [Intanet Content Databse]
> In my opinion it's not a good practice. Do the spaces really add anything
> extra to the name? Furthermore, why do you need to add the "Database" (or
> "Databse" in your case) identifier? Do your client tools merge databases
> and other types of objects in the same views, such that you need the
> additional text to differentiate between them in a list?
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
>
>|||Brackets are required both when creating them and when referencing them. I
assume Sharepoint does that automatically for you...
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...[vbcol=seagreen]
> Its froma Admin. stanpoint. These databses are created my Sharepoitn
> Services. I'm assuming the brackets are required when I reference them.
> I
> don't actual name them [Intanet Databse] do I?
> "Adam Machanic" wrote:
>|||And you can also use double-quotes, "Intanet Databse", which is the ANSI SQL
way to delimit
identifiers.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
> Brackets are required both when creating them and when referencing them.
I assume Sharepoint does
> that automatically for you...
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...
>|||Sharepoint doesn't create it with Brackets. It shows up in EM as Inranet
Company Content.
"Tibor Karaszi" wrote:

> And you can also use double-quotes, "Intanet Databse", which is the ANSI S
QL way to delimit
> identifiers.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
>|||The brackets (or double-quotes) are used when referencing the database.
They are not part of the string -- just there to delimit it.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:A782969A-728B-44E5-98C2-8BB105BFC421@.microsoft.com...[vbcol=seagreen]
> Sharepoint doesn't create it with Brackets. It shows up in EM as Inranet
> Company Content.
> "Tibor Karaszi" wrote:
>

Database Name

Hi,

Can anyone tell me how to return the current database name using T-SQL.

I have a stored proc that runs in a number of databases and would like qualify some dynamic sql with the database name. I know DB_Name exists but requires the DB_ID and DB_ID needs the DB_Name. Is there a function that just returns the current database i.e.

USE TestDB

GO

SELECT currentDBName?

Use the following function..

Select db_name()

|||

Cheers...

sql

Database name

Is it indeed a requirement that database mirrors have the same name on a server? The reason I ask is that I have several servers with the same database name, and I'd like to mirror all of them to a single (disaster) server and, by necessity, have each mirror to a distinct db name.

Thanks

The database MUST have the same name on both the Principal and the Mirror. Mirroring will not work in your scenario unless you provide distinct names for the databases.

Database Name

Can you have Databse names that contain spaces such as Intanet Content
Databse? Will this cause any issues in SQL 2000?You can, but you need to delimit the names with brackets:
[Intanet Content Databse]
In my opinion it's not a good practice. Do the spaces really add anything
extra to the name? Furthermore, why do you need to add the "Database" (or
"Databse" in your case) identifier? Do your client tools merge databases
and other types of objects in the same views, such that you need the
additional text to differentiate between them in a list?
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
> Can you have Databse names that contain spaces such as Intanet Content
> Databse? Will this cause any issues in SQL 2000?|||Its froma Admin. stanpoint. These databses are created my Sharepoitn
Services. I'm assuming the brackets are required when I reference them. I
don't actual name them [Intanet Databse] do I?
"Adam Machanic" wrote:
> You can, but you need to delimit the names with brackets:
> [Intanet Content Databse]
> In my opinion it's not a good practice. Do the spaces really add anything
> extra to the name? Furthermore, why do you need to add the "Database" (or
> "Databse" in your case) identifier? Do your client tools merge databases
> and other types of objects in the same views, such that you need the
> additional text to differentiate between them in a list?
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
> > Can you have Databse names that contain spaces such as Intanet Content
> > Databse? Will this cause any issues in SQL 2000?
>
>|||Brackets are required both when creating them and when referencing them. I
assume Sharepoint does that automatically for you...
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...
> Its froma Admin. stanpoint. These databses are created my Sharepoitn
> Services. I'm assuming the brackets are required when I reference them.
> I
> don't actual name them [Intanet Databse] do I?
> "Adam Machanic" wrote:
>> You can, but you need to delimit the names with brackets:
>> [Intanet Content Databse]
>> In my opinion it's not a good practice. Do the spaces really add
>> anything
>> extra to the name? Furthermore, why do you need to add the "Database"
>> (or
>> "Databse" in your case) identifier? Do your client tools merge databases
>> and other types of objects in the same views, such that you need the
>> additional text to differentiate between them in a list?
>>
>> --
>> Adam Machanic
>> Pro SQL Server 2005, available now
>> http://www.apress.com/book/bookDisplay.html?bID=457
>> --
>>
>> "George Schneider" <georgedschneider@.news.postalias> wrote in message
>> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
>> > Can you have Databse names that contain spaces such as Intanet Content
>> > Databse? Will this cause any issues in SQL 2000?
>>|||And you can also use double-quotes, "Intanet Databse", which is the ANSI SQL way to delimit
identifiers.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
> Brackets are required both when creating them and when referencing them. I assume Sharepoint does
> that automatically for you...
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...
>> Its froma Admin. stanpoint. These databses are created my Sharepoitn
>> Services. I'm assuming the brackets are required when I reference them. I
>> don't actual name them [Intanet Databse] do I?
>> "Adam Machanic" wrote:
>> You can, but you need to delimit the names with brackets:
>> [Intanet Content Databse]
>> In my opinion it's not a good practice. Do the spaces really add anything
>> extra to the name? Furthermore, why do you need to add the "Database" (or
>> "Databse" in your case) identifier? Do your client tools merge databases
>> and other types of objects in the same views, such that you need the
>> additional text to differentiate between them in a list?
>>
>> --
>> Adam Machanic
>> Pro SQL Server 2005, available now
>> http://www.apress.com/book/bookDisplay.html?bID=457
>> --
>>
>> "George Schneider" <georgedschneider@.news.postalias> wrote in message
>> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
>> > Can you have Databse names that contain spaces such as Intanet Content
>> > Databse? Will this cause any issues in SQL 2000?
>>
>|||Sharepoint doesn't create it with Brackets. It shows up in EM as Inranet
Company Content.
"Tibor Karaszi" wrote:
> And you can also use double-quotes, "Intanet Databse", which is the ANSI SQL way to delimit
> identifiers.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
> news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
> > Brackets are required both when creating them and when referencing them. I assume Sharepoint does
> > that automatically for you...
> >
> >
> > --
> > Adam Machanic
> > Pro SQL Server 2005, available now
> > http://www.apress.com/book/bookDisplay.html?bID=457
> > --
> >
> >
> > "George Schneider" <georgedschneider@.news.postalias> wrote in message
> > news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...
> >> Its froma Admin. stanpoint. These databses are created my Sharepoitn
> >> Services. I'm assuming the brackets are required when I reference them. I
> >> don't actual name them [Intanet Databse] do I?
> >>
> >> "Adam Machanic" wrote:
> >>
> >> You can, but you need to delimit the names with brackets:
> >>
> >> [Intanet Content Databse]
> >>
> >> In my opinion it's not a good practice. Do the spaces really add anything
> >> extra to the name? Furthermore, why do you need to add the "Database" (or
> >> "Databse" in your case) identifier? Do your client tools merge databases
> >> and other types of objects in the same views, such that you need the
> >> additional text to differentiate between them in a list?
> >>
> >>
> >> --
> >> Adam Machanic
> >> Pro SQL Server 2005, available now
> >> http://www.apress.com/book/bookDisplay.html?bID=457
> >> --
> >>
> >>
> >> "George Schneider" <georgedschneider@.news.postalias> wrote in message
> >> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
> >> > Can you have Databse names that contain spaces such as Intanet Content
> >> > Databse? Will this cause any issues in SQL 2000?
> >>
> >>
> >>
> >
> >
>|||The brackets (or double-quotes) are used when referencing the database.
They are not part of the string -- just there to delimit it.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:A782969A-728B-44E5-98C2-8BB105BFC421@.microsoft.com...
> Sharepoint doesn't create it with Brackets. It shows up in EM as Inranet
> Company Content.
> "Tibor Karaszi" wrote:
>> And you can also use double-quotes, "Intanet Databse", which is the ANSI
>> SQL way to delimit
>> identifiers.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
>> news:OzwT9DeKGHA.964@.tk2msftngp13.phx.gbl...
>> > Brackets are required both when creating them and when referencing
>> > them. I assume Sharepoint does
>> > that automatically for you...
>> >
>> >
>> > --
>> > Adam Machanic
>> > Pro SQL Server 2005, available now
>> > http://www.apress.com/book/bookDisplay.html?bID=457
>> > --
>> >
>> >
>> > "George Schneider" <georgedschneider@.news.postalias> wrote in message
>> > news:BF29447B-189F-4E4F-B531-0D1E43522A55@.microsoft.com...
>> >> Its froma Admin. stanpoint. These databses are created my Sharepoitn
>> >> Services. I'm assuming the brackets are required when I reference
>> >> them. I
>> >> don't actual name them [Intanet Databse] do I?
>> >>
>> >> "Adam Machanic" wrote:
>> >>
>> >> You can, but you need to delimit the names with brackets:
>> >>
>> >> [Intanet Content Databse]
>> >>
>> >> In my opinion it's not a good practice. Do the spaces really add
>> >> anything
>> >> extra to the name? Furthermore, why do you need to add the
>> >> "Database" (or
>> >> "Databse" in your case) identifier? Do your client tools merge
>> >> databases
>> >> and other types of objects in the same views, such that you need the
>> >> additional text to differentiate between them in a list?
>> >>
>> >>
>> >> --
>> >> Adam Machanic
>> >> Pro SQL Server 2005, available now
>> >> http://www.apress.com/book/bookDisplay.html?bID=457
>> >> --
>> >>
>> >>
>> >> "George Schneider" <georgedschneider@.news.postalias> wrote in message
>> >> news:294E9BC0-5A7A-490E-B678-63242CCA6B3D@.microsoft.com...
>> >> > Can you have Databse names that contain spaces such as Intanet
>> >> > Content
>> >> > Databse? Will this cause any issues in SQL 2000?
>> >>
>> >>
>> >>
>> >
>> >
>>

database name

Is there a way to determine the current database the session is using? I want
to use this to determine if a script should proceed. It should only proceed
if the current database is not a system database.
I was thinking something like,
IF (select dbid < 6) THEN RAISERROR.
Thoughts' Thanks!Check books online for db_name.
If you execute something like:
select db_name()
you will get the current database name.
-Sue
On Mon, 13 Sep 2004 16:41:12 -0700, "Bevo"
<Bevo@.discussions.microsoft.com> wrote:
>Is there a way to determine the current database the session is using? I want
>to use this to determine if a script should proceed. It should only proceed
>if the current database is not a system database.
>I was thinking something like,
>IF (select dbid < 6) THEN RAISERROR.
>Thoughts' Thanks!|||if ( db_name != 'mydb') Raiserror ('Incorrect database',16,1)
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Bevo" <Bevo@.discussions.microsoft.com> wrote in message
news:4A5919FA-B5A6-4B2E-BF05-F681FBA08019@.microsoft.com...
> Is there a way to determine the current database the session is using? I
want
> to use this to determine if a script should proceed. It should only
proceed
> if the current database is not a system database.
> I was thinking something like,
> IF (select dbid < 6) THEN RAISERROR.
> Thoughts' Thanks!|||I will not know the name of the database to be used, but I will know that it
is not a system database.
Can I be sure that all database ids greater than 6 are not system databases?
If so, the logic would be this:
if ( db_id(db_name()) < 6) Raiserror ('Must not be a system database',16,1)
"Wayne Snyder" wrote:
> if ( db_name != 'mydb') Raiserror ('Incorrect database',16,1)
>
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Bevo" <Bevo@.discussions.microsoft.com> wrote in message
> news:4A5919FA-B5A6-4B2E-BF05-F681FBA08019@.microsoft.com...
> > Is there a way to determine the current database the session is using? I
> want
> > to use this to determine if a script should proceed. It should only
> proceed
> > if the current database is not a system database.
> >
> > I was thinking something like,
> >
> > IF (select dbid < 6) THEN RAISERROR.
> >
> > Thoughts' Thanks!
>
>|||There is no need for db_name().
e.g.
If (db_id()<6) Raiserror ('Must not be a system included database',16,1)
Howerver, it's best to be explicit because you would never know if there
would be more than 6 system included databases. Plus, the db_id for the 7th
might be >6. Thus,
If (db_name() in ('master','msdb','tempdb','model','Northwind','Pubs'))
Raiserror ('Must not be a system included database',16,1)
"Bevo" <Bevo@.discussions.microsoft.com> wrote in message
news:10284D82-E541-46F4-B3C3-C76AA021BA40@.microsoft.com...
> I will not know the name of the database to be used, but I will know that
it
> is not a system database.
> Can I be sure that all database ids greater than 6 are not system
databases?
> If so, the logic would be this:
> if ( db_id(db_name()) < 6) Raiserror ('Must not be a system
database',16,1)
>
> >

Database MSDB in suspect state.

Anything in the SQL Server logs?
>--Original Message--
>Hi Friends,
>MSDB database for my SQL 2000 Enterprise is in SUSPECT
state. I have enough free space on disk. I don't see
anything particular in Windows event viewer.
>Please help.
>Regards,
>Jamil
>.
>
Ok...Here is the current situation. MSDB is out of SUSPECT state. In query analyzer I am asked to recover it first before I can use it. Also SQL Agent service will still not start.
Thanks
"Kevin3NF" wrote:

> Anything in the SQL Server logs?
> state. I have enough free space on disk. I don't see
> anything particular in Windows event viewer.
>
|||Still looking for what the SQL logs say about the recovery
efforts on that db. Also, do you have a good backup?
What changed before the db went suspect?
>--Original Message--
>Ok...Here is the current situation. MSDB is out of
SUSPECT state. In query analyzer I am asked to recover it
first before I can use it. Also SQL Agent service will
still not start.
>Thanks
>"Kevin3NF" wrote:
>.
>

Database MSDB in suspect state.

Hi Friends,
MSDB database for my SQL 2000 Enterprise is in SUSPECT state. I have enough free space on disk. I don't see anything particular in Windows event viewer.
Please help.
Regards,
Jamil
what happens if you run a sp_resetstatus 'msdb'?
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Jamil Ahsan" <JamilAhsan@.discussions.microsoft.com> wrote in message
news:3954BE12-CAD0-41C1-A437-EEC82D4E09E1@.microsoft.com...
> Hi Friends,
> MSDB database for my SQL 2000 Enterprise is in SUSPECT state. I have
enough free space on disk. I don't see anything particular in Windows event
viewer.
> Please help.
> Regards,
> Jamil
>
|||When I run resetstatus I get a warning that I need to recover this database first.
"Hilary Cotter" wrote:

> what happens if you run a sp_resetstatus 'msdb'?
> --
> Hilary Cotter
> Looking for a book on SQL Server replication?
> http://www.nwsu.com/0974973602.html
>
> "Jamil Ahsan" <JamilAhsan@.discussions.microsoft.com> wrote in message
> news:3954BE12-CAD0-41C1-A437-EEC82D4E09E1@.microsoft.com...
> enough free space on disk. I don't see anything particular in Windows event
> viewer.
>
>
|||Jamil,
I use this checklist to troubleshoot such issues:
http://www.karaszi.com/SQLServer/inf...suspect_db.asp
HTH,
Paul Ibison
sql

Database Movement

Hello, I normally use the database backup and restore commands when I am
moving one database for one computer to another. This time however, I
brought over the raw files for the log and data. How can I get sql server
to incorporate these files into the server that I am placing them on. This
server does not have that database at all. I moved the files to the
location it normally places the log and datafiles, but when I brought SQL
server up, it did not show me those files in enterprise manager.
Any ideas how to utilize these files in SQL server?
Thanks in advance for your assistance!!!!!!Look up sp_attach_db and sp_detach_db in BOL (Books On-Line).
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"C_Silin" <OverwhelmedButStillTrying@.hotmail.com> wrote in message
news:Xns9485989199631CSilinhotmailcom@.207.46.248.16...
> Hello, I normally use the database backup and restore commands when I am
> moving one database for one computer to another. This time however, I
> brought over the raw files for the log and data. How can I get sql server
> to incorporate these files into the server that I am placing them on.
This
> server does not have that database at all. I moved the files to the
> location it normally places the log and datafiles, but when I brought SQL
> server up, it did not show me those files in enterprise manager.
> Any ideas how to utilize these files in SQL server?
> Thanks in advance for your assistance!!!!!!

Database Movement

Hello, I normally use the database backup and restore commands when I am
moving one database for one computer to another. This time however, I
brought over the raw files for the log and data. How can I get sql server
to incorporate these files into the server that I am placing them on. This
server does not have that database at all. I moved the files to the
location it normally places the log and datafiles, but when I brought SQL
server up, it did not show me those files in enterprise manager.
Any ideas how to utilize these files in SQL server?
Thanks in advance for your assistance!!!!!!Look up sp_attach_db and sp_detach_db in BOL (Books On-Line).
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"C_Silin" <OverwhelmedButStillTrying@.hotmail.com> wrote in message
news:Xns9485989199631CSilinhotmailcom@.20
7.46.248.16...
quote:

> Hello, I normally use the database backup and restore commands when I am
> moving one database for one computer to another. This time however, I
> brought over the raw files for the log and data. How can I get sql server
> to incorporate these files into the server that I am placing them on.

This
quote:

> server does not have that database at all. I moved the files to the
> location it normally places the log and datafiles, but when I brought SQL
> server up, it did not show me those files in enterprise manager.
> Any ideas how to utilize these files in SQL server?
> Thanks in advance for your assistance!!!!!!

Database moved - How to change subscriptions

I want to change a subscription that has been created by another user. I'am NOT an administrator of the server, but I've given me all Reporting-Services permissions (including systemadministrator). The logfile says that I have to be a member of the sysadmin-role to change subscriptions owned by another user.
Thanks
Benjamin

I found out, that the problem appears when I move the database from one machine to another. All works fine, but the owner of the SQL-Server-Agent Job seems to cause the problems. On the source-machine it is ASPNET and on destination-machine its SYSTEM, when I manually change it back to ASPNET I can edit/save the subscriptions.

So how do I set the owner of the SQL-Server Agent Jobs programaticly for all Jobs?
Or is my concept of moving the database via backup/restore not the best solution?

Thanks
Benjamin

|||

After you have moved the database to another machine, you could actually go ahead and just delete all the RS generated SQL Agent Jobs before you start up the report server windows service.

On startup of the RS windows service it will automatically recreate the agent jobs if they were deleted.

-- Robert

|||Restarting the Service creates the jobs, thats right, but they have still the wrong owner..
On both machines the owner is ASPNET if I create a new subscription (or look at a existing subscription on the test-server). Deleting the Agent-Job and starting the Report-Server Service creates the Agent-Jobs with System as owner!
Even on the test-machine(source) deleting the Agent-Job and restarting ReportingServices produces this error..
I've made a little stored procedure which changes the owners, after running it all works as expected..
Create PROCEDURE [dbo].[sp_AlterOwnerOfAgentJob] ( @.username nvarchar(128))
AS
BEGIN
SET NOCOUNT ON;
declare @.jobname nvarchar(128),@.servername nvarchar(128),@.UserID uniqueidentifier
DECLARE job_cursor CURSOR FOR select name from msdb.dbo.sysjobs
OPEN job_cursor
FETCH NEXT FROM job_cursor INTO @.jobname
WHILE @.@.FETCH_STATUS = 0
BEGIN
EXEC msdb.dbo.sp_update_job @.job_name=@.jobname, @.owner_login_name=@.username
FETCH NEXT FROM job_cursor INTO @.jobname
END
CLOSE job_cursor
DEALLOCATE job_cursor
END
GO
exec sp_AlterOwnerOfAgentJob 'SERVERNAME\ASPNET'
GO

Is there any sp to list all jobs? That would make my sp work in further versions..
|||

Thanks for reporting this issue. We will look into this in more detail.

-- Robert

sql

Database moved - How to change subscription of another user.

I want to change a subscription that has been created by another user. I'am NOT an administrator of the server, but I've given me all Reporting-Services permissions (including systemadministrator). The logfile says that I have to be a member of the sysadmin-role to change subscriptions owned by another user.
Thanks
Benjamin

I found out, that the problem appears when I move the database from one machine to another. All works fine, but the owner of the SQL-Server-Agent Job seems to cause the problems. On the source-machine it is ASPNET and on destination-machine its SYSTEM, when I manually change it back to ASPNET I can edit/save the subscriptions.

So how do I set the owner of the SQL-Server Agent Jobs programaticly for all Jobs?
Or is my concept of moving the database via backup/restore not the best solution?

Thanks
Benjamin

|||

After you have moved the database to another machine, you could actually go ahead and just delete all the RS generated SQL Agent Jobs before you start up the report server windows service.

On startup of the RS windows service it will automatically recreate the agent jobs if they were deleted.

-- Robert

|||Restarting the Service creates the jobs, thats right, but they have still the wrong owner..
On both machines the owner is ASPNET if I create a new subscription (or look at a existing subscription on the test-server). Deleting the Agent-Job and starting the Report-Server Service creates the Agent-Jobs with System as owner!
Even on the test-machine(source) deleting the Agent-Job and restarting ReportingServices produces this error..
I've made a little stored procedure which changes the owners, after running it all works as expected..
Create PROCEDURE [dbo].[sp_AlterOwnerOfAgentJob] ( @.username nvarchar(128))
AS
BEGIN
SET NOCOUNT ON;
declare @.jobname nvarchar(128),@.servername nvarchar(128),@.UserID uniqueidentifier
DECLARE job_cursor CURSOR FOR select name from msdb.dbo.sysjobs
OPEN job_cursor
FETCH NEXT FROM job_cursor INTO @.jobname
WHILE @.@.FETCH_STATUS = 0
BEGIN
EXEC msdb.dbo.sp_update_job @.job_name=@.jobname, @.owner_login_name=@.username
FETCH NEXT FROM job_cursor INTO @.jobname
END
CLOSE job_cursor
DEALLOCATE job_cursor
END
GO
exec sp_AlterOwnerOfAgentJob 'SERVERNAME\ASPNET'
GO

Is there any sp to list all jobs? That would make my sp work in further versions..
|||

Thanks for reporting this issue. We will look into this in more detail.

-- Robert

database move help

Greetings.
My company is buying a new, more robust server for their SQL database. It's
currently running on a W2K Server and will be moved to a Win 2003 Server
with more horsepower. Can anyone tell me if this hard to do and where I
could find more "how to" info? Thx!
These should help:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scri...p?scriptid=599
Restoring a .mdf
http://www.support.microsoft.com/?id=307775 Disaster Recovery Articles
for SQL Server
http://www.support.microsoft.com/?id=274463 Copy DB Wizard issues
Andrew J. Kelly SQL MVP
"Mark Adams" <MarkAdams71@.earthlink.net> wrote in message
news:OVmv59ocEHA.2504@.TK2MSFTNGP12.phx.gbl...
> Greetings.
> My company is buying a new, more robust server for their SQL database.
It's
> currently running on a W2K Server and will be moved to a Win 2003 Server
> with more horsepower. Can anyone tell me if this hard to do and where I
> could find more "how to" info? Thx!
>

database move

I recently moved a database and its transaction log file to another drive due
to space issues. I followed the kb article 224071 on how to move a user
database and it appears that it worked correctly.
However, now the database comes up as "read-only" and if I view the
properties of the db and try to remove the "read-only" designation, I get an
error that it can't.
Any thoughts?
Robert
Hi Robert
Check the SQL Server error log to see if there is any information on the
problem. You may also want to check that the readonly attribute is not set on
the mdf and ldf files.
John
"Robert Gandrud" wrote:

> I recently moved a database and its transaction log file to another drive due
> to space issues. I followed the kb article 224071 on how to move a user
> database and it appears that it worked correctly.
> However, now the database comes up as "read-only" and if I view the
> properties of the db and try to remove the "read-only" designation, I get an
> error that it can't.
> Any thoughts?
> Robert
|||In the move of this large db/log to another volume, the sql service account
that starts mssqlserver didn't have specific rights to the new location. I
gave it full control to the new db location and rebooted.
The error log then stated that it performed a full recovery on that db,
which it couldn't do before. I was then able to remove the Read-only
property in the db properties in Ent. Mgr.
Thanks for your help.
Also, for some reason, I have about a 30GB log file. I was under the
understanding that if I backup the transaction log, that it would commit the
transactions and severly reduce my log file size, but that didn't seem to
work.
Any thoughts on that?
Thanks again,
Robert
"John Bell" wrote:
[vbcol=seagreen]
> Hi Robert
> Check the SQL Server error log to see if there is any information on the
> problem. You may also want to check that the readonly attribute is not set on
> the mdf and ldf files.
> John
> "Robert Gandrud" wrote:
|||Hi
Check out
http://msdn.microsoft.com/library/de...r_da2_1uzr.asp
on shrinking the transaction log.
John
"Robert Gandrud" wrote:
[vbcol=seagreen]
> In the move of this large db/log to another volume, the sql service account
> that starts mssqlserver didn't have specific rights to the new location. I
> gave it full control to the new db location and rebooted.
> The error log then stated that it performed a full recovery on that db,
> which it couldn't do before. I was then able to remove the Read-only
> property in the db properties in Ent. Mgr.
> Thanks for your help.
> Also, for some reason, I have about a 30GB log file. I was under the
> understanding that if I backup the transaction log, that it would commit the
> transactions and severly reduce my log file size, but that didn't seem to
> work.
> Any thoughts on that?
> Thanks again,
> Robert
> "John Bell" wrote:

Database Move

Hi
I am doing a test database migration for SQL Reporting Services (leaving
the front end as it is). I have successfully moved the database using
http://support.microsoft.com/?kbid=842425 as ref guide. I have also moved
the databases that the reports uses to collect data from. I have updated
the data source icon for the reports to point to new database location.
When i want to view the reports i now get the following error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection
Have i missed a step to get this working (there is no mention on KB842425
about security settings)?
Your help will be appreciated.
--
Regards
James[MVP for MBS Great Plains]
Visit MBS Blog Central
http://mbscentral.blogs.comDoes SQL Reporting Services Datasource support named instanced server names?
--
Regards
James[MVP]
Visit MBS Blog Central
http://mbscentral.blogs.com
"James[MVP]" <hushdontspamme@.Hotmail.com> wrote in message
news:ONGULWCRFHA.2744@.TK2MSFTNGP10.phx.gbl...
> Hi
> I am doing a test database migration for SQL Reporting Services (leaving
> the front end as it is). I have successfully moved the database using
> http://support.microsoft.com/?kbid=842425 as ref guide. I have also
> moved the databases that the reports uses to collect data from. I have
> updated the data source icon for the reports to point to new database
> location.
> When i want to view the reports i now get the following error:
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection
> Have i missed a step to get this working (there is no mention on KB842425
> about security settings)?
> Your help will be appreciated.
> --
> Regards
> James[MVP for MBS Great Plains]
> Visit MBS Blog Central
> http://mbscentral.blogs.com
>|||Yes.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsinstall/htm/gs_installingrs_v1_8k82.asp
Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"James[MVP]" <hushdontspamme@.Hotmail.com> schrieb im Newsbeitrag
news:efJ0hmCRFHA.1396@.TK2MSFTNGP10.phx.gbl...
> Does SQL Reporting Services Datasource support named instanced server
> names?
> --
> Regards
> James[MVP]
> Visit MBS Blog Central
> http://mbscentral.blogs.com
> "James[MVP]" <hushdontspamme@.Hotmail.com> wrote in message
> news:ONGULWCRFHA.2744@.TK2MSFTNGP10.phx.gbl...
>> Hi
>> I am doing a test database migration for SQL Reporting Services (leaving
>> the front end as it is). I have successfully moved the database using
>> http://support.microsoft.com/?kbid=842425 as ref guide. I have also
>> moved the databases that the reports uses to collect data from. I have
>> updated the data source icon for the reports to point to new database
>> location.
>> When i want to view the reports i now get the following error:
>> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>> Server connection
>> Have i missed a step to get this working (there is no mention on
>> KB842425 about security settings)?
>> Your help will be appreciated.
>> --
>> Regards
>> James[MVP for MBS Great Plains]
>> Visit MBS Blog Central
>> http://mbscentral.blogs.com
>|||If SQL Server remains on a second machine, the SQL Server must handle
delegation.
http://pluralsight.com/blogs/keith/archive/2004/07/08/1586.aspx
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"James[MVP]" <hushdontspamme@.Hotmail.com> schrieb im Newsbeitrag
news:ONGULWCRFHA.2744@.TK2MSFTNGP10.phx.gbl...
> Hi
> I am doing a test database migration for SQL Reporting Services (leaving
> the front end as it is). I have successfully moved the database using
> http://support.microsoft.com/?kbid=842425 as ref guide. I have also
> moved the databases that the reports uses to collect data from. I have
> updated the data source icon for the reports to point to new database
> location.
> When i want to view the reports i now get the following error:
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection
> Have i missed a step to get this working (there is no mention on KB842425
> about security settings)?
> Your help will be appreciated.
> --
> Regards
> James[MVP for MBS Great Plains]
> Visit MBS Blog Central
> http://mbscentral.blogs.com
>

database move

I recently moved a database and its transaction log file to another drive du
e
to space issues. I followed the kb article 224071 on how to move a user
database and it appears that it worked correctly.
However, now the database comes up as "read-only" and if I view the
properties of the db and try to remove the "read-only" designation, I get an
error that it can't.
Any thoughts'
RobertHi Robert
Check the SQL Server error log to see if there is any information on the
problem. You may also want to check that the readonly attribute is not set o
n
the mdf and ldf files.
John
"Robert Gandrud" wrote:

> I recently moved a database and its transaction log file to another drive
due
> to space issues. I followed the kb article 224071 on how to move a user
> database and it appears that it worked correctly.
> However, now the database comes up as "read-only" and if I view the
> properties of the db and try to remove the "read-only" designation, I get
an
> error that it can't.
> Any thoughts'
> Robert|||In the move of this large db/log to another volume, the sql service account
that starts mssqlserver didn't have specific rights to the new location. I
gave it full control to the new db location and rebooted.
The error log then stated that it performed a full recovery on that db,
which it couldn't do before. I was then able to remove the Read-only
property in the db properties in Ent. Mgr.
Thanks for your help.
Also, for some reason, I have about a 30GB log file. I was under the
understanding that if I backup the transaction log, that it would commit the
transactions and severly reduce my log file size, but that didn't seem to
work.
Any thoughts on that?
Thanks again,
Robert
"John Bell" wrote:
[vbcol=seagreen]
> Hi Robert
> Check the SQL Server error log to see if there is any information on the
> problem. You may also want to check that the readonly attribute is not set
on
> the mdf and ldf files.
> John
> "Robert Gandrud" wrote:
>|||Hi
Check out
http://msdn.microsoft.com/library/d...r />
_1uzr.asp
on shrinking the transaction log.
John
"Robert Gandrud" wrote:
[vbcol=seagreen]
> In the move of this large db/log to another volume, the sql service accoun
t
> that starts mssqlserver didn't have specific rights to the new location.
I
> gave it full control to the new db location and rebooted.
> The error log then stated that it performed a full recovery on that db,
> which it couldn't do before. I was then able to remove the Read-only
> property in the db properties in Ent. Mgr.
> Thanks for your help.
> Also, for some reason, I have about a 30GB log file. I was under the
> understanding that if I backup the transaction log, that it would commit t
he
> transactions and severly reduce my log file size, but that didn't seem to
> work.
> Any thoughts on that?
> Thanks again,
> Robert
> "John Bell" wrote:
>sql