sql-server-2008

Review host system privilages assigned to SQL Server 2008 DBA account

Hi, Is there a way to check if the SQL Server 2008 windows login with sysadmin previlages have other host system (windows 2003) previages on the system...? Is there a way to use TSQL to find this? or what are the other options avaliable to verify this?? ...

A View Over a XML Data Type Column

I have a table that contains a column of XML Datatype (column name FileContent). I want to create a view that queries the contents of the XML datatype column so that I no longer have FileContent column but two additional columns called FuelPathwayCode and PhysicalPathwayCode from the underlying XML document. Is this possible with SQL S...

Cannot shrink transaction log,no matter what I do.

I have a database whose tlog has grown to 4.5 GB. The db is in full recovery mode and I have tried several transaction log backups coupled with DBCC shrinkfile. And it will not shrink. Does anyone have any ideas? There are several transactions which have a status =2, but there are no active transactions in the database. I wonder why the...

How to drop a list of SQL Server tables, ignoring constraints?

I have a list of half a dozen MSSQL 2008 tables that I would like to remove at once from my database. The data has been entirely migrated to new tables. There is no reference in the new tables to the old tables. The problem being that old tables comes with loads of inner FK constraints that have been autogenerated by a tool (aspnet_regs...

getting schema + first 100 records from every table in a db

i have a large sql server db, and i want to get the schema (all tables/triggers/sprocs), i'm pretty sure that's easy. but the tough part is that i want to get 100 records from each table. it's a huge db on a remote server and i can't develop locally without a mockup copy. thanks for your help! ...

Optional where clause / parameter in a SQL 2008 stored proc?

Hi everyone, I'm writing some code that updates a table. Depending on what the user wants to do, it either updates a large set of records, or a smaller one. The delineating factor is a group ID. The user can choose whether to update the table for all records, or just those with that groupID. I'd like to use the same stored procedu...

How to move SQL Server 2008 to the cloud?

I have a large (~40gb) SQL Server 2008 database that I would like to move to the cloud. The database uses a lot of SQL Server 2008 specific (and non-specific) features (SQLCLR, xml, indexes, partitions, etc). Thus, my preference would be to use the exact database, but in the cloud. What are my options? The new SQL Azure only allows smal...

Traverse an XML Document in a SQL Server 2008 Database Column

I have a table that contains a column that is XML data type. I am looking to put a view over the entire table including the XML data type column. The view will expand contents of the XML data type column. I am having a problem being able to traverse the entire XML document and pick up values from particular XML nodes. I am using this...

SQL Server 08 - way to edit one specific row in the GUI

In Microsoft SQL Server Management Studio 2008 - is there not a secret to being able to edit one row based on a key? There's an option to do "Edit Top 200 Rows", but what if I want to select some other row and edit it in the data-grid? I would rather do that than code an update statement and risk messing up the where clause. Is th...

Do clients of a SQL Server 2008 need to be on a Network domain or can they also be in a workgroup ?

Hi, When we install a SQL Server 2008 on the Windows 2008 server and the SQL clients on the PC's in the network, is there any pre-requisite that these clients should only be on a Domain controller network and not on a workgroup ? The vendor who is installing this claims that it has to be a PDC based network whereas we feel the workgrou...

How to Architect an offline database

Using Sql Server 2008, .Net 3.5 & C#. I am designing a desktop application that runs in a read-only state when there is no internet connection. When the connection is available again it will use webservices to update the central DB. What technologies could I use to 'download' a set of data applicable to each client for use offline? ...

Using HierachyID to store time series data

I have a SQL Server database that holds a large number of time series records -currently about 500 million. Each record has a datetime and a double data value which form the time series, and two other datetimes values. I'm looking at ways to improve the performance of queries without going down the data warehouse route. Instead of s...

Performance impact of indexed view in MS SQL Server 2008

Does anyone have experience with using indexed view in MS SQL Server 2008? I am trying to find out how does indexed view affect performance of insert / update statements, that are adding / updating rows in tables, which are being used by the indexed view (assuming the indexed view is a select joining a few tables together). Given that al...

What's the best SQL Server setup for a development environment?

Hi, We are a small team using Visual Studio 2008 for development and SQL Server 2008 Standard in the production servers. We are seting up a new development lab and I am wondering about SQL Server versions/editions and configuration. Visual Studio 2008 comes with a development license of SQL Server 2005, but since we are only targetting...

Tool to Document SQL Server Schema

Can anyone recommend a free (or cheap) program out there which allows me to easily document what certain tables and fields are used for in our applications? Ideally, when we update a fields type, it would automagically update in this tool. Also, showing what fields are indexed etc would be beneficial. What solutions have you guys / gals...

Is there any way to extend the editor in SSMS?

Can the SQL Server Management Studio text editor be extended? If it's possible, what kind of work & tools are involved? I find myself frequently jumping to other editors for certain kinds of text manipulation, and then jumping back to SSMS. If it were possible to extend the SSMS editor, I might do so. The first feature I would add wou...

How to declare array inside Sql Server Stored Procedure?

Hi All I need to declare 12 decimal variables, corresponding to each month's year, with a cursor I sum values to this variables, then later I Update some sales information. I don't know if sql server have this syntax Declare MonthsSale(1 to 12) as decimal(18,2) This code works Ok. ! CREATE PROCEDURE [dbo].[proc_test] AS BEGIN -...

Getting the Whole Time

How can I get the whole time like this datediff(time, logindate, logoutdate) I know this built-in function doesn't accept time argument but how can I get the whole time rather than minute, millisecond, second etc. ? logindate datetime2 logoutdate datetime2 I want something like 1:05:45 rather than portion of it. ...

SQL Server 2008 DB recovery: does it actually work?

Today I have rebooted my Win2008 Server with SQL Server 2008 running on it. After rebooting SQL Server marked my database as "In recovery", so I can't use this database until recovering finished. The question is - how much dose it takes to finish recovery process and does it actually do the recovery (or SQL Server just lock my db and not...

Restoring two databases to precisely the same time

In SQL Server 2008, I have my parent table in one database, and the child table in another database, with FK relationship maintained by triggers. I cannot change it, cannot move both tables into one DB and have a regular FK constraint. When I restored both databases from full backups, I had orphans in my child table, because the full bac...