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

learn more… | top users | synonyms (1)

0
votes
3answers
57 views

Matching two rows in a single table if two specific keys have different values

I have a table called settings in that there are two columns and data like following. settings value ------- ------ depots 12 projectid 156 client ...
2
votes
2answers
410 views

70-432 : SQL Server 2008 Implementation and Maintenance

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?
1
vote
3answers
3k views

How to calculate exact month (in days) difference b/w two dates

I am trying to get all the rows where the visit date was exact before five months from to date but somehow DateDiff function is including 26th Sept 2013 record which is not right as five month has ...
3
votes
1answer
4k views

Restore Backup Fails - File 'Db' cannot be restored to '{…}.mdf'. Use WITH MOVE to identify a valid location for the file

I am getting the following errors trying to do a restore using the restore command on a backup file I recieved from a customer. RESTORE DATABASE SFDB FROM DISK = N'C:\Backup\Backup.bak' Any ...
0
votes
0answers
86 views

SQL Server - constraint to prevent overlapping dates [duplicate]

I saw this wonderful article called "CHECK Constraint To Avoid Overlapping Data" It basically boils down to this: CREATE TABLE Reservations (ReservationID int NOT NULL PRIMARY KEY, ...
1
vote
3answers
1k views

SQL Server mirrored database is stuck in recovery mode

I have a database that is stuck in recovery mode for few days already. There are multiple threads about this, but the solutions there don't work for me. Here is what I tried already: RESTORE ...
6
votes
2answers
1k views

Bitmask Flags with Lookup Tables Clarification

I've received a dataset from an outside source which contains several bitmask fields as varchars. They come in length as low as 3 and as long as 21 values long. I need to be able to run SELECT queries ...
4
votes
2answers
84 views

Impact of deleting 100GB table on Mirroring

I'm about to delete a large table which is approximately 100GB in size. I'd like to understand the impact on the mirroring that's in place on this db. Can anyone confirm?
6
votes
1answer
8k views

Finding last time table was updated?

The query: SELECT name AS TableName, create_date AS CreatedDate, modify_date as ModifyDate FROM sys.tables order by ModifyDate will tell me the last time a table was created and modified (from a ...
0
votes
0answers
45 views

same query different servers,different execution plan and time

I have this query and it runs less than 2 minutes on Test but on Prod it takes 10 minutes. Both are the same version,CPU,RAM,OS the same. I have four tempdb files on Prod but one one Test. I ...
1
vote
1answer
40 views

Will Rebuild and Reorganize improve Database Migration Script performance execution?

I would like to know if a Database Schema Migration Script (generated by Visual Studio 2008 or greater) will run faster if my target database got indexes rebuilt and/or reorganized. Note: For all ...
2
votes
3answers
1k views

Incredibly slow query performance

I have a query that is used to populate an aggregate table for reporting purposes. The query comes from another developer here at the company I work for but is my job to make it run fast. So far all ...
0
votes
2answers
55 views

Copy DB from SQL Server 2008 to SQL Server 2012

I have several databases on SQL Server 2008 that I wish to transfer to SQL Server 2012. The two servers are on the same network but separate domains. I am attempting a DB Copy from the one server to ...
1
vote
1answer
50 views

Single row to multiple rows with column combination

I have a table like this: ╔═════╦═══════╦════╦════╦═════╦═════╦═════╦═════╦════╦════╗ ║ ZIP ║ STATE ║ F ║ C ║ F1 ║ c1 ║ f2 ║ c2 ║ f3 ║ c3 ║ ...
0
votes
2answers
36 views

Defragmentation of Indexes - Higher value after defragmentaion

I am trying to defragment indexes on SQL Server 2008 using ALTER INDEX--REBUILD. After defragmentation some indexes have fragmentation percentage value greater than its before defragmentation value. ...
0
votes
0answers
27 views

how to check the condition before running the sequence container in ssis2005

I need to split the DB into Current(2012,2013,2014) and History(previous to 2012). Every year I need the oldest year should move to history DB i.e if 2015 enters then 2012 should move to history. ...
8
votes
2answers
4k views

Can Windows Authentication logins be disabled on SQL Server 2008 (or R2)?

So we can do Windows Login or Mixed Mode, but can we configure SQL Server to only use internal logins and to block all Windows Logins? Is the only solution to add all potential Windows logins and set ...
0
votes
2answers
167 views

Force spool to avoid creating temp tables?

I have the following query which join pivoted data of several very big tables and it runs very slow. I tried to created the temp table for each pivoting and it runs much faster. Is it a way to force ...
0
votes
2answers
158 views

Joining tables with one to many relationship

Hi I have a service ticketing system database (SQL Server 2008) which i want to get the hour elapsed for the tickets. One table contained the Ticket number and the created date/time while the other ...
2
votes
2answers
5k views

declaring cursor to loop over some values in SQL server 2008 R2

I have some business unit such as India, International, US, UK. I have to: Create a table variable (virtual in-memory table) with columns that match SPROC SP_Report resultset. Declare a cursor that ...
0
votes
1answer
62 views

Indexes and their uses [closed]

Index improve performance in select statement, but what is the difference between this create clustered index ix_index1 on table1(col1) create clustered index ix_index2 on table1(col2) and this ...
5
votes
2answers
1k views

Optimisation of complex query - 100% cost index seek?

I'm a c# developer, however I'm quite experienced with SQL. I have had a bit of experience with optimising queries but I've come up across one that has me stumped. The query takes about 3 minutes to ...
10
votes
1answer
798 views

Scalar function used in calculated column, what's the cleanest way to update the function?

I want to update a scalar function in our database. This function is used for several calculated columns in a key table so I get a dependency error if I try to update it. I can explicitly remove the ...
1
vote
0answers
40 views

Different Execution Plans Picked for Similar Queries

Thank you in advance for reading it. This question is kind of long and need a little patience to read. I will provide as much details as I can to void interference factors to solve this problem. ...
6
votes
2answers
3k views

How do I check for a null or empty table-valued parameter?

I have a stored procedure (SS2k8) with a couple table-valued parameters that will sometimes be null or empty. I have seen this StackOverflow post that says that null/empty TVPs should simply be ...
2
votes
3answers
1k views

Msg 21, Level 21, State 1, Line 1 Warning: Fatal error 9001

We recently moved to a SQL Server that's on a VPS and every now and then we get a 9001 error when trying to do an update. Rebooting the server fixes the problem. I changed the maximum server memory ...
0
votes
2answers
56 views

Transfer all tables from a schema to other schema

I have two schema. Schema1 and Schema2 How would I transfer all the tables from schema1 to schema2?
0
votes
3answers
139 views

Is it possible to have the transaction log file write to a disk on a remote machine?

For the SQL server transaction log file, it is possible to set its target file to a disk on a remote machine? I am working on a BI project. In its current iteration, when the data warehouse ...
3
votes
2answers
355 views

Data sharing between client and server two ways

One of my Silverlight applications is running. This Application is using one central database (SQL Server 2008) and three other client databases (SQL Server 2008) in server other locations. Our ...
1
vote
1answer
31 views

How to update a single record in a table based of foriegn key ID in another table?

I am still very new to sql. I am having troubles updating one table. I am sending information from a web application into Microsoft SQL 2008 database. I have a table called EmployeePermissions that ...
0
votes
2answers
61 views

Are #tables and #procedures 'not best practice' or 'bad practice'?

I am working on a project and part of it is an interface tool that executes SQL code stored in a xml file to import/export files. In the file, temp procedures and temp tables are used quite heavily ...
0
votes
1answer
55 views

SQL Server : slowness / CPU issues [closed]

We have a SQL Server with about 15 databases and about 60 + users accessing any of these databases. Each database is designed to serve different data set (meaning - we have multiple roles in each ...
0
votes
0answers
38 views

Track record deltas/changes on SQL Server 2008

Trying to build some sort of ETL process that copies rows from SQL Server into Elasticsearch indexing server. My ETL process should be able: Detect new rows inserted to the SQL Server table. Detect ...
4
votes
3answers
138 views

Virtual Log Files (VLFs) Fragmentation

I have a database with 160 VLFs. How do I determine whether the VLFs are fragmented? Further, how do I find the percentage of fragmentation? Another thing that I want to confirm: Are the following ...
2
votes
2answers
333 views

In SQL Server 2008, in DMV sys.dm_db_index_phsicial_stats, what does compressed_page_count mean in comparision with page_count

In SQL Server 2008, DMV sys.dm_db_index_physical_stats, what does compressed_page_count mean in comparison with page_count. I have a table with the following info: Object_id Index_type_desc ...
1
vote
1answer
51 views

set date value based on other row values

Sorry for the Header, I can't find the right way to describe what I want, possibly the reason why I can't get a solution by googling :) ... Here my problem: I've got a table with the following ...
1
vote
1answer
169 views

change display of rows into single row in SQL server 2008

I have created a db that contains the following 2 small tables Here is the db script USE [Test1July] GO /****** Object: Table [dbo].[Hotels] Script Date: 07/01/2014 22:33:33 ******/ SET ...
5
votes
3answers
244 views

Backup not creating a new file

I run a daily backup of my database through command prompt: c:\sqlcmd -H localhost -Q "BACKUP DATABASE test TO DISK='c:\test.bak'" But the new backup replaces the previous backup. Please tell me ...
0
votes
1answer
38 views

Coalesce per row - get all Detail IDs grouped per HeaderRow e.g. Invoice1 | 1,2,3 Invoice 2 | 4,5,6

I have the following demo data (taken from Adventureworks) SalesOrderNumber SalesOrderDetailID SO43659 12 SO43659 11 SO43659 8 SO43659 9 SO43660 ...
5
votes
2answers
3k views

Data type for storing an array of flags (a bitmap/bit array)

I need to store a bit array for each record of a table, supporting the following operations: Testing if a bit is set, and setting a bit (using SQL) Querying and setting the value using ADO 2.8 (not ...
0
votes
1answer
30 views

Index Maintenance Plan

At our organisation we are migrating to SQL Server from visual foxpro dbf and hence had no maintenance plans and have no DBA. We have gone through our backup plans and Index maintenance is only index ...
-2
votes
1answer
62 views

Using the “Select Top (100) percent vs. Select * , or selecting any column” [closed]

I wrote the first query below that I was hopeing to give me the exact same results that the 2nd query does, but it seems there is one recrod different: SELECT DocumentSourceName FROM ...
1
vote
4answers
123 views

Is it ok to change from full recovery to simple recovery in Sql Server

I have an old database - a users membership/role that was setup automatically by an ASP.Net 2 application years ago: The Sql Server version currently running is: Sql Server 10.5.1617 The users ...
1
vote
2answers
960 views

rsExecutionNotFound when directly accessing an SSRS report

I have an SSRS report that can I access from the Web Portal but once I try to access it directly through the URL, I get the following error: Execution 'xxx' cannot be found (rsExecutionNotFound). I ...
0
votes
1answer
42 views

How to Sum Each Enum Value in a Different Column and Don't Repeat Person's Name?

Let's say I have a table with SellerId, DateTime, ProductType to register each time a a Seller sells a product. The ProductType is from ENUM type with { 0=Phone, 1=Recharge, 2=SimCard }. Then I have a ...
2
votes
4answers
10k views

How to create and send mail in SQL Server 2008?

I want to send E-mail from SQL Server 2008. What are the basic steps for that? Can you explain me if someone used this facility. Any help will appreciated. this link will helpful as commented by ...
5
votes
1answer
4k 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 ...
1
vote
2answers
464 views

Alternatives to joins using Linked Server and OPENQUERY

In my environment, we have a server that stores sales data and another server that stores our HR data. For some reports, we need to combine sales data with employee data. Our sales server contains ...
2
votes
1answer
54 views

Moving Clustered Index to new filegroup results in excessive filegrowth

I've Moved the clustered index on large tables to new filegroups to defrag, compress, and to recover space more easily from the original "primary" filegroup. Problem: A 315GB compressed Clustered ...
3
votes
1answer
535 views

Backing up file groups with restore to earlier backup

I have a task: I have created a database with a filegroup lamb that has a few tables. I need to extract a csv into a table in a filegroup named lamb and back up that filegroup. Then extract another ...