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

learn more… | top users | synonyms (1)

4
votes
2answers
474 views

Best way to identify orphan data?

I have a few dozen tables, that have data in them, both for the core set of data, and then the company specific data. I can never delete the core set of data, that is global for all companies. But i ...
3
votes
1answer
119 views

Permissions Dropped after Package Failed

I created a local db and then set up a one-off job to copy the live db to this new db. Or at least that's what I thought I'd done. The logs suggest that the job thought it had to create the db on live ...
3
votes
1answer
665 views

Which fillfactor is used by ALTER INDEX REBUILD?

From technet I got the impression, that I either have to explicitly set the wanted fillfactor or when I do not specify it, the default fillfactor 0 is choosen. For tables I know to get rows added ...
24
votes
2answers
4k views

Find Queries that Are Causing Waits

Given a certain kind of wait, how do you find which queries are causing those waits safely on a production SQL 2008 R2 Server? In this particular case I am wondering about async_network_io.
3
votes
1answer
192 views

Add credentials & set a specific role for a database

How can we add login credentials & roles for a particular database? There is ServerObject,replication & management folders in MS SQLmanagement studio. What's the significance of these ...
11
votes
3answers
1k views

What's the most effective way to duplicate an instance on SQL 2008?

We've got a simple database instance with just enough data in the databases to keep it useful, and we can use it for demonstration purposes, and I want to put a copy of it on my laptop so I can use it ...
2
votes
1answer
920 views

Is it possible to specify Active Directory username and password in connection string?

My organization uses Active Directory to control access to our databases. Building web applications and as part of our CI process I would like to specify the credentials in the connection string. Is ...
3
votes
2answers
2k views

bcp in of datetime type data results in an “Invalid date / time format”

I am familiarizing myself with the bcp utility, and I have a large table containing datetime data awhich I bcp out in several ways: native, character, delimited. I then bcp in to a truncated table ...
1
vote
3answers
697 views

SQL Server tempdb question

From what I understand the system database is used to hold temporary tables, intermediate results and other temporary information. On one of my database instances I have a tempdb that is seems very ...
4
votes
3answers
3k views

How to insert multiple records using XML in SQL server 2008

i use SQL server 2008 in my web application back end. Apparently i iterate through all the records from the C# code whenever there is a multiple insertion scenario. i have never tried the multple ...
6
votes
3answers
19k views

Read XML file in SQL Server 2008

How can I read an XML file and store the data in XML to our table in SQL Server 2008?
3
votes
2answers
138 views

SQL server 2005 backup statistic

I'd like to share with you this simple snippet (answering my own question) and I'm also curious how do you control your SQL server backups.
3
votes
1answer
12k views

trying to turn XML into heirarchical SQL tables, can anyone provide a good explanation of two parts of this code example?

I am trying to learn how to turn XML into heirarchical SQL tables. I have found an old code snippet from a Microsoft forum which is basically what I am trying to do, but I was wondering if someone ...
4
votes
1answer
2k views

Illegal XML character out of the extended event

I'm capturing extended events in SQL server. Trying to analyse the trace - converting the event data to xml an error comes up: Msg 9420, Level 16, State 1, Line 28 XML parsing: line 1, character 731, ...
4
votes
1answer
129 views

Is there a non-DDL way to preserve back-references when staging data into production?

Let's say I've got this hypothetical schema: Source (OLTP) DB: Table Orders ------------ OrderID int IDENTITY (PK), CustomerID int NOT NULL, OrderAmount decimal NOT NULL Destination (DSS) DB: ...
5
votes
3answers
388 views

SELECT * WHERE VarCharColumn IN (…) Optimization

I have a list of 3000 strings, and I am passing them (twenty at a time) into a parametrized IN clause. It definitely isn't getting the results I would like to see ~ 500ms per execution. The column is ...
7
votes
1answer
643 views

Can I prevent SQL 2008 Server Management Studio's intellisense from autocompleting with the longest word?

In SQL 2008 Server Management Studio: is there a way to keep intellisense from always picking the longest word to autocomplete? For example, I could be trying to type the word client and it'll ...
7
votes
1answer
426 views

How can I rewrite for SQL Server a trigger that writing for Oracle?

How can I rewrite for SQL Server a trigger that was originally written for Oracle ? Here is my Oracle trigger code: CREATE OR REPLACE TRIGGER P000KUL_TEST BEFORE INSERT ON P000KUL REFERENCING NEW AS ...
8
votes
5answers
204 views

What is the best way to find out how many records do not have a proper phone number in SQL Server?

I have a field that people historically could use to freely supply a value. I need to identify the records which do not have an appropriate value so I can clean them. I've been looking around in SSIS ...
5
votes
2answers
2k views

BULK INSERT - best usage

I need to export 150 million rows of only int/bigint columns from one SQL instance to another. I am using BCP queryout to export the rows and BULK INSERT to import the rows to another table. I split ...
4
votes
2answers
737 views

Best Setup for Database Cluster

I need to set up a good database clustering solution for a system that I am putting into production. I was hoping to get some advice from the experts as I am a primarily a developer and not a database ...
3
votes
2answers
1k views

Keeping “SQL Trace was started” and “SQL Trace stopped” from filling up my SQL logs

I have a SQL2008 server that runs a custom application that starts and then stops a SQL trace every 60 seconds (it does some reporting and summarization on the trace data). The problem is that my SQL ...
5
votes
3answers
1k views

How do I rename my local SQL development server?

I'm a dev who inherited a mostly functioning box doing most of what I need. Except for the machine name is still that of the old dev (we name it "{username}-dt" or "{username}-lt" for ease of id on ...
0
votes
1answer
1k views

detaching database results in error “SQL Server detected a logical consistency-based I/O error”

I'm trying to detach a database and I'm getting this error : SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:234; actual 0:0). It occurred during a read ...
1
vote
2answers
3k views

SSMS: Show execution plan for a stored procedure as a single tree

I execute a stored procedure with an option "Include Actual Execution Plan". The execution plan always is represented by multiple statements each of which has its own execution plan. MSDN states the ...
4
votes
2answers
4k views

Help solving a Clustering Issue: [sqsrvres] ODBC sqldriverconnect failed

I have a 2 node cluster (NODE-A & NODE-B) with 2 SQL instances spread between them. INST1 prefers NODE-A, INST2 prefers NODE-B. INST1 started generating errors then, failed over to NODE-B. ...
7
votes
3answers
541 views

Data Warehouse Creation

I'm fairly green when it comes to this field. I'm a data analyst at a small hospital 8 months now, out of a 2 year degree in a new career field for me. Situation We have a Cobol "database" (I ...
9
votes
6answers
2k views

SQL Server command line usage? Is it possible?

I've been trying to use the SQL Server Management Studio 2008's built in "Solution Explorer" to manage a project and after 2 weeks of struggling with it, I've decided I don't really care for it. It's ...
7
votes
1answer
343 views

Why would running ALTER TABLE on a column cause it to go from NOT NULL to NULL?

I am mass updating a SQL Server database. I am changing all our numeric(38,0) columns to int (yes, SQL Server scripts were created from Oracle scripts). Using SMO and C# (I am a sw engineer), I ...
5
votes
2answers
544 views

Date alignment and pair matching extraction best done with TSQL or C#?

For starting with: my title sucks, so help me figure out a new one? I can't post all the SQL here (over 30k characters for the lot of it), so I stuck it on pastebin.com The problem: I get an XML ...
6
votes
3answers
4k views

LIKE to select the independent existence of the word whereever in the text

I have a table with the following texts and the key word i am searching for is 'Search'.So i have written a query SELECT [ID] ,[TextValue] FROM [dbo].[SearchLike] WHERE [TextValue] LIKE ...
1
vote
3answers
257 views

Selecting an entry that spans adjacent months

So i have a database table that contains the a "event name", "start-date", "end-date" columns which is used in a calendar application im working on. The events get shown one month at a time, and that ...
3
votes
2answers
2k views

Best way to sync a table between two sql server databases with an identity key

I have an SSIS package that moves data from a table into another table in another database. The source table has an identity key. I need to perform some operations on the data. The only way I can ...
10
votes
7answers
24k views

Moving tables to another SQL2008 database (including indexes, triggers, etc.)

I need to move a whole bunch (100+) of large (millions of rows) tables from one SQL2008 database to another. I originally just used the Import/Export Wizard, but all the destination tables were ...
1
vote
1answer
1k views

Can't stop replication sp_dropdistpublisher responds “there are subscribers defined”

I am running into errors: exec sp_dropdistpublisher @publisher='servername' response: Msg 21047, Level 16, State 1, Procedure sp_dropdistpublisher, Line 145 Cannot drop the local distribution ...
5
votes
3answers
9k views

How to restore multiple backups

I'm using ExpressMaint and Windows Scheduled Tasks to create weekly full and daily differential backups of some MS SQL Server 2008 R2 Express databases Weekly fulls expressmaint -S ...
3
votes
2answers
639 views

Using CLR User Defined Functions in SQL Server

I have used CLR user defined functions for very specific instances, such as complex string handling, but generally didn't like them from a maintenance point of view (yet another place to hide code). ...
4
votes
1answer
346 views

what is the first schema checked?

I am a little confused right now. Can someone answer me with a simple answer to this question. I have a user [user_test] and has [db_owner] role assigned to him for one database [database_test]. ...
22
votes
3answers
26k views

How do I get back some deleted records?

I mistakenly deleted around 2,000,000 records from a remote SQL Server 2008 table. The server is not granting me access to the backup files on the server side. Is there any way to get back these ...
1
vote
1answer
2k views

Linked Server Problem

I have a MSSQL2008 and MSSQL2005 in my system.All SP's is up-to-date. 2008; Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (X64) Sep 16 2010 19:43:16 Copyright (c) 1988-2008 Microsoft ...
9
votes
4answers
11k views

How to detect any changes to a database (DDL and DML)

There are a lot of databases on my client's sql server. In common, these databases is under development, so developers can design, refactor, do data modifications and so on. There are some databases ...
7
votes
2answers
13k views

How do I determine if a table exists in a SQL Server database in SQL Server 2008?

How do I determine if a table exists in a SQL Server database in SQL Server 2008?
1
vote
5answers
4k views

How to restore database using old full backup and current log file

What is happened? My client has lost the hard disk. He has to restore database. He has the full backup of database 15 days old. He has ldf (log) file of this database. He has NOT mdf file (it was ...
1
vote
1answer
890 views

Query Linked Access database on network share via SQL Job Agent

I have an MS Access database on a shared network location which I've added as a linked server to my SQL Server instance. I'm authenticated on the network location via the server's main Windows login. ...
1
vote
2answers
1k views

Connect a linked server to MS Reporting Service?

I've got a MYSQL server setup as a linked server in MS SQL server 2008. Can someone tell me if it is possible to generate reports from this server? How do I connect it to Reporting Services?
3
votes
2answers
3k views

Error Querying MySQL server linked to SQL Server 2008

I've created a linked server in MS SQL Server 2008 to a remote MySQL server. When I try to query any tables, I get an error: .tablename. contains no columns that can be selected or the current user ...
6
votes
3answers
569 views

Inserting and updating and selecting at thousands of times per second

I have a table that gets inserted, updated and selected from thousands of times within one second. I am having deadlock issues though. The database has 2-5 simultaneous 1000+ row inserts using Linq ...
9
votes
2answers
2k views

How large is “too large” for SQL 2008 Web Edition?

For our soon-to-be-hosted application I need to choose between SQL Server 2008 Web edition and SQL Server 2008 Enterprise edition. There isn't any "must-have" functionality: the application currently ...
5
votes
3answers
837 views

SQL Server renaming table from another database

Is there a way in SQL Server to rename a table in another database? When you are in current database and migrating data over to another database in the TEMP table and then renaming TEMP table in that ...
4
votes
1answer
112 views

Data transformation implementation

My company's database, I am working with, makes available a data to a lot of external applications. So I need to transform the same data to a lot of dynamic views. I can see that a former database ...