This tag is for SQL Server 2008, major build version 10.00.xxxx.

learn more… | top users | synonyms (1)

9
votes
5answers
3k views

Do empty columns take up space in a table?

I have table that holds from very basic info. Just a title and a few date fields. There's one field called comments which is varchar(4000) Most of the time we leave it blank, but some times will enter ...
2
votes
1answer
1k views

Moving Tables Indexes to Separate file / file-groups, What Happens?

I'm trying to get a grasp on whats going on when you move objects to a separate filegroup / .ndf file. *This is for a 3rd party app that sucks that I have no access to source, and is entirely ...
6
votes
2answers
1k views

DTA Recommends to CREATE STATISTICS

I just ran a T-SQL query through DTA and one of the recommendations is to CREATE STATISTICS on one of the columns that is part of many of the queries in the SQL code file. My question is, how exactly ...
3
votes
1answer
507 views

Does T-SQL MOVE actually move the database, or just copy?

I'm a bit confused over the T-SQL command MOVE. I have a statement saying: MOVE N'Prod_Database_Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Test_Database.mdf' ...
3
votes
4answers
197 views

how to interpret log files with high transactions

I'm having this issues with too many logs files being generated. Over 60gb in the last 24 hours. It's not a massively high transactional website. What is the best way to read the log files and work ...
6
votes
1answer
5k views

Difference between EXEC() and sp_executesql with no parameters?

I just learned about the new sp_executesql stored procedure. I like the fact that there's a way to execute parameterized code from within SQL Server. But, I'm wondering what the difference is ...
3
votes
1answer
204 views

Minimum rowcount for filtered index?

Creating an index always has trade-offs. Whenever you insert, update or delete, it has to perform those operations on the index as well. This is all pretty commonly known. But with the advent of ...
4
votes
2answers
2k views

SQL Server database forum design sample

I am doing a design for a database using SQL Server 2008 R2, basically it is a simple database design for a forum (just like games fans forums). Fortunately I am struggling with it as I didn't find ...
11
votes
3answers
3k views

Can I move rows between partitions by updating the partition key?

I would think that this would be a fairly simply question, but I've actually had a difficult time finding an answer for this. The question: Can you move rows of data within a partitioned table from ...
1
vote
1answer
1k views

Install SQL server 2008 R2 with VS 2010

Ok, I've installed SQL Server 2008 R2. I'm trying to add a "SQL Server Database" to an ASP MVC project. But it keeps telling me I need SQL Server for it to work. What do I need to do to setup the ...
3
votes
2answers
278 views

How to track how many times the data is read?

I want to track how many times records are read in a specific table. Let's say that we have this table ID Name 1 Cat 2 Dog 3 Fish I want to know how many times the record ...
6
votes
1answer
4k views

Find all ancestor nodes of a HierarchyId using a single SQL statement?

I'm trying to find a way to get all ancestor nodes of a given node using HierarchyID. Every solution I've seen using HierarchyID seems to use either a CTE or a variable. Is there a way to do this ...
1
vote
1answer
411 views

SQL Server sp_configure options?

Does anybody know where I can find a list of all the parameter options for sp_configure? It isn't really jumping out at me when I search online for possible variations and the capabilities of ...
4
votes
3answers
360 views

Using DTA vs. evaluating DMVs?

Currently I am confronted with a production SQL Server database where someone had added almost all missing index proposals from DTA. Form How to determine if an Index is required or necessary I have ...
2
votes
2answers
492 views

70-432 : SQL Server 2008 Implementation and Maintenance [closed]

Has anybody taken this certification exam? If so, how many years of experience do you have as a SQL Server DBA and how hard did you find the exam?
3
votes
1answer
147 views

In which form Microsoft SQL password should be given when creating a user?

I am creating a Microsoft SQL server user with the guidance of this MSDN article and giving the system the following commands: CREATE LOGIN MyName WITH PASSWORD = 'MyPass'; USE My$DatabaseName; ...
9
votes
1answer
4k views

How to use transactions with SQL Server DDL?

I have a login table into which all inserts are done by a single stored procedure. CREATE TABLE dbo.LogTable( LogRefnr int IDENTITY(1, 1) NOT NULL, LogQuery varchar(255) NOT NULL, LogTime ...
3
votes
2answers
3k views

Problem Reaching VM SQL Server Instance

Here's what I'm working with right now. I have a host OS which includes a SQL Server 2008 Enterprise instance. I have a virtual machine running on this host which has a SQL Server 2008 R2 Express ...
2
votes
1answer
419 views

SQL Server 08: Union over while

I've done some reading on this, and I keep seeing people say it's a bad idea, but hear me out! I have a stored procedure which needs to find a series of timeslots over a number of days. Due to the ...
5
votes
3answers
680 views

Using SQL Server on separate networks

I have a bunch of SQL Servers installed on Windows2008R2. Currently, each windows server has two NIC's, each connecting to separate networks. In other words, each server appears on each network. ...
4
votes
4answers
3k views

Empty strings in VARCHAR(MAX) consuming space which cannot be recovered

I have a table with a non-nullable VARCHAR(MAX) column where every row contains an empty string (third party database so I can't change it). I see a huge amount of space use, over 15GB for 1 million ...
1
vote
1answer
532 views

IS_SRVROLEMEMBER returning NULL for valid non windows user

I have a service that executes a stored procedure to query the db for results. The stored procedure needs to use impersonation on the user who is logged in the client (since the service has its own ...
4
votes
2answers
1k views

Best way to evenly distribute data over partitioned tables

I am working with a database with roughly around 500MM records. We currently use a static partitioning method that partitions the data by an int identifier such at < 150MM goes on partition 1, > ...
2
votes
2answers
580 views

SQL Server Replication Agent Profile -Output Parameter

I'm trying to add the -Output parameter to my log reader agent for transactional replication and getting this error: Msg 21805, Level 16, State 1, Procedure sp_MSvalidate_agent_parameter, Line 92 The ...
1
vote
1answer
119 views

I need help migrating data through databases

I have a web page with some data about the users. Recently, I made a complete change and start developing a new portal and of course a new DB structure. My question : What is the best way to migrate ...
1
vote
2answers
2k views

Statement could not be prepared

I've got a SQL Server 2008 server set up with a linked server to a 2005 server. On the 08 server i've got a view set up that's pulling data from the '05 server. This scenario works from my dev '08 ...
6
votes
3answers
2k views

Will the transaction log shrink automagically in SQL Server?

When SQL Server database in a SIMPLE mode, you don't have to care about the transaction log bakcups. But in a SIMPLE mode, the transaction log seems to grow as it does in FULL mode. Does is truncate ...
2
votes
2answers
1k views

Is it possible with SQL Server 2008 to have a Partioned Tables with an Identity Column?

I'm not thinking of using it for the partition function. I just want to know, if it is supported or not. Don't tell me why it is not a good idea to use such columns on partitioned tables.
3
votes
3answers
419 views

Database Schema with a shared identity Field

I'm a developer treading into the database world so bear with me please. I'm creating a Contract database with separate tables for various types of contracts. I have 5 tables but would like to ...
11
votes
1answer
6k views

How do you ORDER BY a parameter?

Just wondering if I could solicit some feedback on a stored procedure I'm running and whether there's a more efficient way of handling the scenario (I'm pretty sure there will be!). Basically I have ...
10
votes
2answers
410 views

@table_variable or #temp_table

I have a big user defined table type variable that has 129 columns. I will store around 2000-3000 records in this table variable at a time and pass it to various stored procedures and functions to get ...
4
votes
2answers
2k views

Role db_ddladmin not working properly on SQL Server 2008

I want to allow certain user to create/modify objects on a database(tables, views, sp's, functions, schemas etc) and don't want to give db_owner. I thought I could do it with the db_ddladmin role, ...
11
votes
3answers
4k views

Schema design - best practices?

I understand the capabilities of SQL Server Schemas, but what are the best practices? Sure they give another layer of security, and provide logical grouping of database objects within the database, ...
1
vote
1answer
698 views

Can IMPLICIT_TRANSACTIONS set on database level?

When I have to investigate problems caused by IMPLICIT_TRANSACTIONS ON, can I focus on Client tools setting IMPLICIT_TRANSACTIONS ON or ANSI_DEFAULTS ON or can this be set for the whole database ...
3
votes
2answers
6k views

How to migrate from SQL Server 2000 to SQL Server 2008 R2 Express Edition

I have been trying to migrate a database from SQL Server 2000 (part of SBS 2003) to SQL Server 2008 R2 Express Edition I naively tried using the SQL Server Export and Import wizard. This has worked ...
5
votes
1answer
408 views

how to improve performance by using or not using table variables

I have a table variable: DECLARE @to_process TABLE ( [Id] [bigint] NOT NULL, [SequenceId] [bigint] NOT NULL, ... ) INSERT INTO @to_process ( Id , SequenceId ... ) SELECT ...
5
votes
1answer
59 views

SQL Server 2008 Index

What would be the best index(es) to add to the tables in order to make this query as fast as possible. The sd.incidents tables is about 2.5M records, problems about 8K, and changes about 120K. select ...
4
votes
2answers
296 views

How do I track the usage of XML indexes?

My XML indexes are not listed in sys.dm_db_index_usage_stats Does this mean they aren't being used? Or does this particular DMV not track XML index usage? (Books Online doesn't appear to answer the ...
2
votes
4answers
9k views

No Maintenance Plans Folder in SQL Studio 2008 R2 [closed]

A client has SQL Server 2008 R2 installed on a Windows 2003 R2 32-bit server. Under Management in SQL Studio 2008 R2, there is no maintenance plans folder. It is not under Management --> Legacy ...
2
votes
4answers
3k views

SQL Server: cold backup, shutting down services?

One of our collagues told me that they are doing "cold" backups for SQL Server so that they are shutting down services and then taking a backup somehow. I think this is all wrong! Am I right? I think ...
3
votes
3answers
1k views

Managing multiple SQL Server databases

My company has many branch offices and each branch has a DB server. Some have SQL Server 2005 and some others have SQL Server 2008. The schema is the same for all these servers. Whenever I want to do ...
9
votes
5answers
12k views

Save Results as CSV *with* headers in SSMS

With SQL Server 2008 R2, when I save the results as a CSV there are no headers. I can work around this by copying and pasting with the "Copy with Headers" , or just grab the headers and paste them in ...
6
votes
1answer
4k views

Add DEFAULT to existing column

In Microsoft SQL server, how can I add/change the default on an existing table column using T-SQL?
3
votes
1answer
628 views

Query Parallelism

I have a long running query that behaves differently between two different machines. I have an 8 core machine running Microsoft SQL Server Developer Edition (64-bit) that does not use parallelism and ...
3
votes
3answers
431 views

How to determinate in a trigger direct inserts and inserts via stored procedure

TableX can be modified in two ways: client does "direct" inserts client uses stored procedure to inserts records How to determinate the way of client's call (direct or stored proc) in a trigger of ...
6
votes
2answers
3k views

Is it possible to get execution call stack in a trigger?

I have 10 stored procedures and each of them does INSERTs into one tableX. Is it possible in a trigger body of tableX to get what object causes modification of tableX (stored proc1 or sp2 or....) ? ...
13
votes
3answers
8k views

How does shrinking a SQL Server log file affect performance?

I have a SQL Server 2008 database that has a data file of some 2GB in size, but the log file is over 8GB. With pre-2008 databases I could use the 'Backup log' and the TRUNCATE_ONLY option but this is ...
6
votes
5answers
6k views

Pros/Cons Using multiple databases vs using single database

Working on a new project which has the requirement to use 7 databases. Arguing performance, stability, optimization is easier implemented. While I don't agree I'm having trouble collecting good ...
3
votes
1answer
524 views

SQL 2008 Server agent cant see perfmon counters

I am trying to create a new SQL server agent alert to capture "SQLServer:General Statistics|Processes Blocked||>|5' but it looks like alert creation GUI is not able to see any perfmon counters as in ...
3
votes
1answer
83 views

How do you move a Database from one server to the other using MS-SQL-SMS

I need to move a database, but I want to make sure I do it safely and with all triggers, store proc and functions. I was think to simply detach the database from my server using MS-SQL-SMS and move ...