Wednesday, March 7, 2012

Contents of FileGroups

All,
Is it possible for a table to exist in more than 1 filegroup? Is it
possible to move all existing instances of that table to just 1
filegroup? . Using the script below:
SELECT DISTINCT (SELECT groupname
FROM sysfilegroups
WHERE groupid = a.groupid)
AS filegroup, OBJECT_NAME(id) AS 'object name'
FROM sysindexes a
WHERE (groupid <> 0)
ORDER BY filegroup, 'object name' ASC
I was about to see which filegroup a table resides in. I know that
where a clustered index exists so to must the table data must follow.
But, while running the above script, I have instances where some tables
exists in two filegroups. Using sp_help, I confirmed that the clustered
index and all other non-clustered indexes reside in FileGroup1. However
running the above script shows that part of the table also resides in
FileGroup2. This only occurs for about 5% of all tables (about 3000).
What would cause such an event? How can one rectify the situation by
merging the table instance on FileGroup2 into FileGroup1 and hopefully
removing this table instance in FileGroup2?
Thanks,
Ian in SDTMK a table can only exist in one filegroup. The filegroup may consist of
multiple files and extents from multiple files may be allocated to the
table. The clustered index actually is the table so creating the clustered
index ON a filegroup will move the table to a different filegroup.
HTH
Jerry
<theredmiata@.hotmail.com> wrote in message
news:1147992470.409194.55030@.i39g2000cwa.googlegroups.com...
> All,
> Is it possible for a table to exist in more than 1 filegroup? Is it
> possible to move all existing instances of that table to just 1
> filegroup? . Using the script below:
> SELECT DISTINCT (SELECT groupname
> FROM sysfilegroups
> WHERE groupid = a.groupid)
> AS filegroup, OBJECT_NAME(id) AS 'object name'
> FROM sysindexes a
> WHERE (groupid <> 0)
> ORDER BY filegroup, 'object name' ASC
> I was about to see which filegroup a table resides in. I know that
> where a clustered index exists so to must the table data must follow.
> But, while running the above script, I have instances where some tables
> exists in two filegroups. Using sp_help, I confirmed that the clustered
> index and all other non-clustered indexes reside in FileGroup1. However
> running the above script shows that part of the table also resides in
> FileGroup2. This only occurs for about 5% of all tables (about 3000).
> What would cause such an event? How can one rectify the situation by
> merging the table instance on FileGroup2 into FileGroup1 and hopefully
> removing this table instance in FileGroup2?
> Thanks,
> Ian in SD
>|||In SQL 2000 a table can only exist inside of 1 FileGroup, but you can create
non-clustered indexes on other filegroups.
In SQL 2005 you can use a partioning scheme to partition a table or an index
across multiple filegroups.
David Lundell
Principal Consultant and Trainer
www.MutuallyBeneficial.com
David@.MutuallyBeneficial.com|||TMK a table can only exist in one filegroup. The filegroup may consist of
multiple files and extents from multiple files may be allocated to the
table. The clustered index actually is the table so creating the clustered
index ON a filegroup will move the table to a different filegroup.
HTH
Jerry
<theredmiata@.hotmail.com> wrote in message
news:1147992470.409194.55030@.i39g2000cwa.googlegroups.com...
> All,
> Is it possible for a table to exist in more than 1 filegroup? Is it
> possible to move all existing instances of that table to just 1
> filegroup? . Using the script below:
> SELECT DISTINCT (SELECT groupname
> FROM sysfilegroups
> WHERE groupid = a.groupid)
> AS filegroup, OBJECT_NAME(id) AS 'object name'
> FROM sysindexes a
> WHERE (groupid <> 0)
> ORDER BY filegroup, 'object name' ASC
> I was about to see which filegroup a table resides in. I know that
> where a clustered index exists so to must the table data must follow.
> But, while running the above script, I have instances where some tables
> exists in two filegroups. Using sp_help, I confirmed that the clustered
> index and all other non-clustered indexes reside in FileGroup1. However
> running the above script shows that part of the table also resides in
> FileGroup2. This only occurs for about 5% of all tables (about 3000).
> What would cause such an event? How can one rectify the situation by
> merging the table instance on FileGroup2 into FileGroup1 and hopefully
> removing this table instance in FileGroup2?
> Thanks,
> Ian in SD
>|||"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:OzNZa4seGHA.4304@.TK2MSFTNGP05.phx.gbl...
> TMK a table can only exist in one filegroup. The filegroup may consist of
> multiple files and extents from multiple files may be allocated to the
> table. The clustered index actually is the table so creating the
> clustered index ON a filegroup will move the table to a different
> filegroup.
>
There are three physical parts to a table, and they can be on seperate file
groups in SQL 2000.
Clustered Index or Page Heap
Non-Clustered Indexes
text, ntext and image data
David

Contents of a SP

Hi all,
How can I select the contents of a SP to a text file
Thanks
RobertRobert Bravery wrote:
> How can I select the contents of a SP to a text file
In SQL Server 2005, you can use the OBJECT_DEFINITION function, like
this:
SELECT OBJECT_DEFINITION(OBJECT_ID('ProcedureNa
me'))
In SQL Server 2000, you can query the syscomments table, like this:
SELECT text FROM syscomments WHERE id=OBJECT_ID('ProcedureName')
but if the procedure text is longer than 4K, it will be split across
multiple rows.
To store the result in a file, either use copy/paste (if it's a
one-time job) or a command-line utility like BCP or OSQL/SQLCMD.
Razvan|||> In SQL Server 2000, you can query the syscomments table, like this:
> SELECT text FROM syscomments WHERE id=OBJECT_ID('ProcedureName')
> but if the procedure text is longer than 4K, it will be split across
> multiple rows.
All the more reason to use sp_helptext instead of selecting from system
tables.|||Another one way in SQL Server 2005 is by using the sys.sql_modules
catalog view
SELECT definition
FROM sys.sql_modules
WHERE object_id = OBJECT_ID('ProcedureName')
Denis the SQL Menace
http://sqlservercode.blogspot.com/
Razvan Socol wrote:
> Robert Bravery wrote:
> In SQL Server 2005, you can use the OBJECT_DEFINITION function, like
> this:
> SELECT OBJECT_DEFINITION(OBJECT_ID('ProcedureNa
me'))
> In SQL Server 2000, you can query the syscomments table, like this:
> SELECT text FROM syscomments WHERE id=OBJECT_ID('ProcedureName')
> but if the procedure text is longer than 4K, it will be split across
> multiple rows.
> To store the result in a file, either use copy/paste (if it's a
> one-time job) or a command-line utility like BCP or OSQL/SQLCMD.
> Razvan|||And of course there is always INFORMATION_SCHEMA.ROUTINES that works EQUALLY
well in SQL 2000 and SQL 2005.
SELECT
ROUTINE_NAME
, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME = {MySprocName}
--
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."
*Yet Another certification Exam
"Razvan Socol" <rsocol@.gmail.com> wrote in message news:1151582710.965580.171600@.d56g2000cw
d.googlegroups.com...
> Robert Bravery wrote:
>
> In SQL Server 2005, you can use the OBJECT_DEFINITION function, like
> this:
> SELECT OBJECT_DEFINITION(OBJECT_ID('ProcedureNa
me'))
>
> In SQL Server 2000, you can query the syscomments table, like this:
> SELECT text FROM syscomments WHERE id=OBJECT_ID('ProcedureName')
> but if the procedure text is longer than 4K, it will be split across
> multiple rows.
>
> To store the result in a file, either use copy/paste (if it's a
> one-time job) or a command-line utility like BCP or OSQL/SQLCMD.
>
> Razvan
>|||But if your proc is longer than 4000 characters then only the first
4000 character will be returned, the rest will be truncated
Denis the SQL Menace
http://sqlservercode.blogspot.com/
Arnie Rowland wrote:
> And of course there is always INFORMATION_SCHEMA.ROUTINES that works EQUAL
LY well in SQL 2000 and SQL 2005.
> SELECT
> ROUTINE_NAME
> , ROUTINE_DEFINITION
> FROM INFORMATION_SCHEMA.ROUTINES
> WHERE ROUTINE_NAME = {MySprocName}
> --
> Arnie Rowland, YACE*
> "To be successful, your heart must accompany your knowledge."
> *Yet Another certification Exam
>
> "Razvan Socol" <rsocol@.gmail.com> wrote in message news:1151582710.965580.
171600@.d56g2000cwd.googlegroups.com...
> --=_NextPart_000_0E97_01C69B57.2E222ED0
> Content-Type: text/html; charset=iso-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 2519
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
> <META content="MSHTML 6.00.5296.0" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY>
> <DIV><FONT face=Arial size=2>And of course there is always
> INFORMATION_SCHEMA.ROUTINES that works EQUALLY well in SQL 2000 and SQL
> 2005.</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face="Courier New" size=2>SELECT </FONT></DIV>
> <DIV><FONT face="Courier New" size=2>
> ROUTINE_NAME</FONT></DIV>
> <DIV><FONT face="Courier New" size=2> ,
> ROUTINE_DEFINITION</FONT></DIV>
> <DIV><FONT face="Courier New" size=2>FROM
> INFORMATION_SCHEMA.ROUTINES</FONT></DIV>
> <DIV><FONT face="Courier New" size=2>WHERE ROUTINE_NAME =
> {MySprocName}</FONT></DIV>
> <DIV><BR><FONT face=Arial size=2>-- <BR>Arnie Rowland, YACE* <BR>"To be
> successful, your heart must accompany your knowledge."</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2>*Yet Another certification Exam</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2></FONT> </DIV>
> <DIV><FONT face=Arial size=2>"Razvan Socol" <</FONT><A
> href="http://links.10026.com/?link=mailto:rsocol@.gmail.com"><FONT face=Arial
> size=2>rsocol@.gmail.com</FONT></A><FONT face=Arial size=2>> wrote in me
ssage
> </FONT><A
> href="http://links.10026.com/?link=news:1151582710.965580.171600@.d56g2000cwd.googlegroups.com"><FONT
> face=Arial
> size=2>news:1151582710.965580.171600@.d56g2000cwd.googlegroups.com</FONT></
A><FONT
> face=Arial size=2>...</FONT></DIV><FONT face=Arial size=2>> Robert Brav
ery
> wrote:<BR>>> How can I select the contents of a SP to a text
> file<BR>> <BR>> In SQL Server 2005, you can use the OBJECT_DEFINITIO
N
> function, like<BR>> this:<BR>> SELECT
> OBJECT_DEFINITION(OBJECT_ID('ProcedureNa
me'))<BR>> <BR>> In SQL Serv
er
> 2000, you can query the syscomments table, like this:<BR>> SELECT text
FROM
> syscomments WHERE id=OBJECT_ID('ProcedureName')<BR>> but if the procedu
re
> text is longer than 4K, it will be split across<BR>> multiple rows.<BR>
> <BR>> To store the result in a file, either use copy/paste (if it's a<B
R>>
> one-time job) or a command-line utility like BCP or OSQL/SQLCMD.<BR>>
> <BR>> Razvan<BR>></FONT></BODY></HTML>
> --=_NextPart_000_0E97_01C69B57.2E222ED0--|||Quite true. I should have added that as a 'proviso'. (My rule of thumb is
that if the sproc exceeds 4k chars, then it is probably not very ATOMIC and
most likely is a candidate for re-enginering. -it doesn't always work, but
is good to have as a goal.)
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."
*Yet Another certification Exam
"SQL Menace" <denis.gobo@.gmail.com> wrote in message
news:1151596104.047640.163330@.j72g2000cwa.googlegroups.com...
> But if your proc is longer than 4000 characters then only the first
> 4000 character will be returned, the rest will be truncated
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
> Arnie Rowland wrote:
>|||> Quite true. I should have added that as a 'proviso'. (My rule of thumb is
> that if the sproc exceeds 4k chars, then it is probably not very ATOMIC
> and most likely is a candidate for re-enginering. -it doesn't always work,
> but is good to have as a goal.)
I'd agree. I very rarely see procedures that exceed 2k, except when I am
working on them for other reasons than size (e.g. they are slow, or do
stupid things). I have inherited a few doozies in the past but there are
certainly none that large in any of the systems I currently maintain (never
mind develop).
A|||Aaron Bertrand [SQL Server MVP] wrote:
> All the more reason to use sp_helptext instead of selecting from system
> tables.
Of course; I forgot about sp_helptext.
Razvan

content of REPLDATA directory

Hi!
There are collecting snapshot agents (SQL7.0) generated files in the separate directories (named like 20030923020007, 20030716020008, and so on) in my ReplData directory.
Why does count of such directories increase without interruption?
Can I delete directories with old date of modifying from my C:\MSSQL7\REPLDATA\unc\ directory?When a snapshot is recreated, SQL will make a new subfolder with datetime stamp as its name to put the data in Repldata folder. There should be a clean up job to delete the subfolder once the snapshot is delivered. My guess is the process has been interrupted so the cleanup step was not completed. You can delete the subfolder since it's no longer being used.

Content Manager Security

I have a user I have given permission to folder and reports as a
Content Manager, but when the user clicks on the security tab for a
folder or report they get an error of:
The permissions granted to user 'DOMAIN\USER_ID' are insufficient for
performing this operation. (rsAccessDenied)
I am an administrator on the machine and fall into the
BUILTIN\Administrators who are Content Managers, and have no problems
whatsoever in viewing and setting security.
What can I do to get this user permission short of making them an
administrator on the machine? Any help would be greatly appreciated.jdcamp,
Did you try wiggling the power cord on the server? Another one that
works for me is to open and close the CD-ROM drive 5 or 6 times then
restart the machine.
Hope I could help!
Mickey|||Are you kidding me? Does anyone have a serious answer on this matter?

Saturday, February 25, 2012

Content Management System where everything is read from a database

Most content management systems I've seen have data from a database, and fixed template and background information held in ASP and XML files. Surely it would be easier and more centralised to have everything stored in a database?

I've created a simple content management system that does this using SQL Server 2003, and it does work, albeit a little slowly.

My intention is to develop this into a "proper" content management system that I could sell.

My question is is this a sensible idea to persue, from a technical perspective? Does SQL Server have the capability of supplying large amounts of data to web browser clients? Are there any other issues?

I've also just noticed that Microsoft appear to have added something similar to this type of functionality in the latest version of SQL: SQL 2005. Maybe I'm too late?

More details on my fledgling system are on:

http://dohat.com/dohatcms

Which itself is hosted on it.

Cheers.

Hi Neil
There are several content management systems commercially available. I believe some of them serve everything off a database. SQL Server 2005 has capability to provide results to requests via SOAP and also contains Reporting Services. I'm not sure if these are the capabilities you refer to.

- Christian Kleinerman
Program Manager
SQL Engine

Content Management System where everything is read from a database

Most content management systems I've seen have data from a database, and fixed template and background information held in ASP and XML files. Surely it would be easier and more centralised to have everything stored in a database?

I've created a simple content management system that does this using SQL Server 2003, and it does work, albeit a little slowly.

My intention is to develop this into a "proper" content management system that I could sell.

My question is is this a sensible idea to persue, from a technical perspective? Does SQL Server have the capability of supplying large amounts of data to web browser clients? Are there any other issues?

I've also just noticed that Microsoft appear to have added something similar to this type of functionality in the latest version of SQL: SQL 2005. Maybe I'm too late?

More details on my fledgling system are on:

http://dohat.com/dohatcms

Which itself is hosted on it.

Cheers.

Hi Neil
There are several content management systems commercially available. I believe some of them serve everything off a database. SQL Server 2005 has capability to provide results to requests via SOAP and also contains Reporting Services. I'm not sure if these are the capabilities you refer to.

- Christian Kleinerman
Program Manager
SQL Engine

Content in MSDE

We have installed a application with MSDE distributed. Is
it possible for us to have a look of the content in the
databases stored in MSDE ?
It is a standalone PC. Is it necessary for us to get the
SA password for accessing the data ? However, if the
vendor hasn't told us, what is the best way to handle it ?
Thanks
Hi,
If you are the Administrator of the OS then you could try accessing SQL
Server using Windows Trusted connection.
Login into OS using an admin account and from command prompt try this
OSQL -S servername -E
This will allow you to to sql prompt . There you can type all TSQL commands
to see the data.
Thanks
Hari
SQL Server MVP
"Daniel" <anonymous@.discussions.microsoft.com> wrote in message
news:0e2701c53fc4$d68d94f0$a501280a@.phx.gbl...
> We have installed a application with MSDE distributed. Is
> it possible for us to have a look of the content in the
> databases stored in MSDE ?
> It is a standalone PC. Is it necessary for us to get the
> SA password for accessing the data ? However, if the
> vendor hasn't told us, what is the best way to handle it ?
> Thanks
|||"Daniel" <anonymous@.discussions.microsoft.com> schrieb im Newsbeitrag
news:0e2701c53fc4$d68d94f0$a501280a@.phx.gbl...
> We have installed a application with MSDE distributed. Is
> it possible for us to have a look of the content in the
> databases stored in MSDE ?
Thats what databases are designed for

> It is a standalone PC. Is it necessary for us to get the
> SA password for accessing the data ? However, if the
> vendor hasn't told us, what is the best way to handle it ?
No not nocessarily, you can also use Windows Authentification to connect to
the database. As a local administrator you are autom. in the system
administrators group (if you didnt change it so far).
try using OSQL connection with the Parameter -E, there you can fire all your
Statements you want to:
If Windows Auth is not activated try changing it via EM or if not applicable
though registry:
http://groups.google.de/groups?q=reg...phx.gbl&rnum=1
HTH, Jens Smeyer.

> Thanks