Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (2)

2
votes
1answer
201 views

Active Directory domain being shutdown— Do I have to update my DBO accounts?

I manage a SQL Server machine (with SQL Server 2000 and 2005 installed) that was first created on an Active Directory domain that we are transitioning away from and are about to shut down. All of my ...
0
votes
2answers
2k views

Conversion failed when converting date and/or time from character string [closed]

I have a problem with this query: SELECT @dateforaftersixmonth=U_PYMON FROM [@CCS_PYRUNPERIODS] WHERE @STRTEMP_DATE between U_BEGDA and U_ENDDA @STRTEMP_DATE is a datetime variable and ...
0
votes
3answers
250 views

How can I connect to SQL server by just using local ip address

Currently I am connecting to SQL server using 192.168.1.157\MyInstance. I would like to connect to SQL server by just using 192.168.1.157 i.e if I type IP addressin SSMS it should connect properly ...
0
votes
3answers
3k views

Database is not accessible after 'taking it offline' process failed

I was trying to detach the DB when it gave me an error that it is currently in use. Hence, I tried to take my DB offline but it failed saying 'an exception occured while executing a transact SQL ...
4
votes
1answer
102 views

Is there a way to start a script on the publisher when synchronization starts?

I am using merge replication with pull subscriptions and Web Sync. What is the easiest way to start a SQL script on the publication database when a subscriber starts the synchronization process? ...
10
votes
4answers
1k views

Rebuilding Indexes, DB now 10x the size

I have a SQL Server database (2008 R2 SP1) that was about 15 gigs. It turns out maintenance hadn't been running in a while, so I created a maintenance plan to rebuild all the indexes, they were very ...
2
votes
2answers
640 views

Remove Database from SQL Management Studio Database List

I'm working with MS SQL Express 2008 and Visual Studio 2010. If you are attached to a local MDF file how do you remove it from the Databases list without deleting the file? The reason is to purge the ...
3
votes
2answers
116 views

When did a specific database come online?

How can I determine when the state of a specific database switched to online? Background: I want to determine how long the database is in use to find out how reliable sys.dm_db_index_usage_stats ...
9
votes
5answers
881 views

UPDATE with JOIN on 100mm records, how to do this better? (in T-SQL)

I need to update 100 million records in a single table, in effect, normalizing the table by replacing the varchar value of a column with simply an ID. (I say "replacing" but really I'm writing the ID ...
11
votes
3answers
1k views

Why does my ORDER BY sort two tables before the EXCEPT (slow) and not after (fast)?

SQL server 2008 R2 query optimizer puzzle We have two tables, both containing 9 million rows. 70.000 rows are different, the others are the same. This is fast, 13 seconds, select * from bigtable1 ...
2
votes
0answers
7k views

SQL Server named instance - can connect remotely, but not locally [closed]

I have an instance of SQL Server on my machine. Machine: Bert01 SQL Server instance: Bert2008 I connect to it using SSMS putting Bert01\Bert2008 in the Server name box, using sa and the . When I ...
1
vote
1answer
120 views

Reconciling dm_os_windows_info windows_sku values, gathering same info from pre SQL Server 2008 R2 instances

I'm developing an inventory system for RDBMS deployments. I'm starting with SQL Server, and later will be pulling in info for Oracle & other RDBMS deployments. When you query [dm_os_windows_info] ...
1
vote
1answer
663 views

Indexed View Slows Replication

I have setup SQL Server transactional replication, and then added indexed views at the subscriber, but the indexed views appear to really slow down the subscriber and almost bringing it to a halt. I ...
4
votes
2answers
82 views

what replication option should I choose?

Just looking for some feedback here, there are lots of replication options out there, and I'd like to try something that those more expert than I have found to be successful. Here's my scenario: 1 ...
3
votes
1answer
110 views

How can I find out which statistics are evaluated by the optimizer?

My enterprise has a farm of many nearly-identical, isolated production environments. Each environment has a SQL Server 2005 database server, each supporting a database with nearly identical schemas. ...
4
votes
3answers
694 views

Write to Error Log

Using SQL Server 2008 R2: How can I write to the SQL Server Error Log? I have a ROLLBACK statement that I'd like to couple with a statement written to the error log for external monitoring. ...
3
votes
1answer
974 views

How to check connection string in SSMS2012?

I'm connected to database. I use db by Management Studio 2012 Express. Can I check connection string by click something in Management Studio?
5
votes
2answers
303 views

Can I prove my database does not have memory issues?

(This is a continuation of do indexes consume memory) A fellow database developer believes we are having memory issues. He has seen increased run times in some standard queries - going from under 10 ...
6
votes
2answers
954 views

Do indexes consume memory?

I am just starting to learn about memory usage on SQL Server. When using the query in the answer to the question SQL Server 2008 R2 "Ghost Memory"?, I discovered that a single database is ...
4
votes
3answers
436 views

Restore a SQL Server database to an offline copy

I have SQL Server Management Studio. I need to access a backup file (*.bak). How do I create a new database engine that is OFFLINE (running from my PC not the server) and then restore the database ...
3
votes
1answer
93 views

Directly acessing the NULL bitmap of a row in SQL Server

I was reading the question Checking a wide table for nulls and I'm wondering if it's possible to somehow directly access the NULL bitmap of a row to fast check if a row contains NULL values. Would ...
5
votes
3answers
636 views

How to transfer files at remote location using sql server job?

I have a job configured in which it transfers the file at remote location. My command is running absolutely fine from the command prompt but when I configured it in sql server job it gives log on ...
7
votes
2answers
3k views

FIFO queue table for multiple workers in SQL Server

I was attempting to answer the following stackoverflow question: What SQL Server 2005/2008 locking approach should I use to process individual table rows in multiple server application instances? ...
4
votes
2answers
159 views

Checking a wide table for nulls [duplicate]

Possible Duplicate: Test if any fields are NULL I am new here. I have a table with 70-odd columns. Is there a way I can check the number of rows with at least one null value in any column ...
8
votes
3answers
315 views

SQL Server query slow when paginated

I am seeing some strange behaviour with the following T-SQL query in SQL Server 2012: select Id FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') order by Name Executing this query alone ...
0
votes
6answers
6k views

How to recover deleted/updated record in sql server or mysql?

I want to know that is there any way that I can can recover the deleted or updated record in the sqlserver and mysql as well?
2
votes
2answers
2k views

All pull subscriptions cannot connect to Distributor

recently all my PULL subscriptions have this message in the synchronization status. :- The process could not connect to Distributor 'DISTRIBUTIONDB' This is only happening with the PULL ...
6
votes
1answer
189 views

Large SQL server advice

Copied my question from StackOverflow after advice from a fellow user: I'm dealing with a quite large SQL Server database and encountering a few problems. The database is quite new and I've been ...
3
votes
2answers
572 views

Parallel Statistics Update

In SQL Server 2008 or later, is UPDATE STATISTICS WITH FULLSCAN a single threaded operation or it can use parallelism? How about update statistics with default sampling - can it use parallelism? I ...
3
votes
1answer
388 views

Wrong behavior in Backups

Checking my Native backup this morning something wierd happened. I will describe the problem here. 1) The msdb table backup set shows me the backup was done successfully. 2) The errorlog shows me ...
3
votes
1answer
142 views

Creating User for a single contained database

I am pretty new working with MSSQL and have 2012 version at the moment. What I'm trying to do is create a user for a contained database, and give that user access only to that database. I will invoke ...
2
votes
3answers
1k views

SQL Server 2008 log directory has too much dump file

My SQL Server log directory has too many dump files. I have 3 databases on the server and the number of the transactions on them is very small, why would there be so many large files??
2
votes
2answers
7k views

Generate create script for all indexes

I am working on documenting my databases, and I would like to create a list of all of the indexes in my database. The reason I want to do this is so that I can track changes to my indexes overtime. ...
0
votes
1answer
362 views

Converting a large SQL Server database to MySQL. Database corruption? Can't access data after transferring [closed]

I have gigabytes of tabular data stored in a SQL Server database. I've been trying to migrate it to MySQL using the Migration Toolkit from Oracle. I didn't have any mapping errors and fixed all the ...
4
votes
2answers
648 views

Replicate DB2 table to SQL Server 2008

I need to replicate data from a DB2 database into a SQL Server Database (along the lines of about 80 tables). I can create an SSIS package, to just flat copy the data from one to another pretty easy, ...
5
votes
4answers
110 views

Syncing Database for Server Transition

I'm transitioning from an old web/sql box combined to a much more robust solution on a completely different host (800hosting to RackSpace). Our application has very high uptime requirements. It runs ...
5
votes
2answers
253 views

Create function in central database or repeat in each database?

One of my developers has written a SQL function that works like the VB.Net function (LastIndexOf) and wants to publish it. My question is what would be the reason to put this in a central database ...
8
votes
1answer
249 views

What is the actual lowest possible positive REAL number

MSDN says that the range of REAL numbers is - 3.40E + 38 to -1.18E - 38, 0 and 1.18E - 38 to 3.40E + 38. Apparently the true lower limit is much lower. The following script populates a REAL column ...
4
votes
2answers
213 views

How to create a summary report that contains other reports?

I have 4 reports that I run for 8 different environments. Each report creates a graph from some usage tables. It's very simple SQL that creates a very simple graph. The guy who used to do these ...
10
votes
4answers
2k views

Table partitioning for archiving data

Scenario: two databases: DB_A and DB_Archive with one very big table called tableA. every day, records older than 60 days are deleted from DB_A and moved to DB_Archive mainly to leave thing ...
2
votes
2answers
439 views

What could trigger that a login created from a certificate is not visible in metadata

I am trying to create a login and grant it rights to run and unsafe assembly but the check on server_principals does not return the login when it already exists. The script works perfectly fine on my ...
5
votes
3answers
1k views

SQL server indexing foreign keys, covering indexes included columns

I have pulled a list of FK's that do not have indexes on them. If a FK does not have a dedicated index on them but are part of wider indexes used for covering queries, Should they have a dedicated ...
3
votes
2answers
2k views

Directory lookup failed when adding sample database to SQL Server 2012

I am trying to add the AdventureWorks sample database to SQL Server 2012, but I get an error message: Msg 5133, Level 16, State 1, Line 1 Directory lookup for the file "C:\Users\A\Documents\SQL ...
-3
votes
1answer
2k views

How to Create a Trigger in SQL Server to Update Cascade When @@RowCount > 1?

I Have 2 Table Table1 | column name | type | |-------------+-------------| | ID1 | Int | | Name | NVARCHAR(50)| Table2 | column name | type | ...
4
votes
3answers
1k views

SQL Server 2005/2008 system timezone

I work on a ship that has multiple SQL Servers, both 2005/2008 versions. As the ship moves from area to area so does our timezone. Sometimes we can jump ahead one hour and then back again. My ...
4
votes
2answers
3k views

Primary key vs. unique index: performance difference with foreign keys?

Will there be any difference in performance if you compare a query fetching data via a join between two tables where there's a relationship against either of the following: A primary key A unique ...
2
votes
0answers
307 views

Why are runtimes different for a table including a primary key versus a table with a clustered unique index added after population [closed]

When I create a temporary table with a PK defined from the outset like this I get great performance in subsequent joins on that key: create table #temp ( field1 int not null field2 int ...
9
votes
2answers
5k views

Slow Performance Inserting Few Rows Into Huge Table

We have a process that takes data from stores and updates a company-wide inventory table. This table has rows for every store by date and by item. At customers with many stores, this table can get ...
4
votes
1answer
862 views

Using FLOATs with RAISERROR

I am using RAISERROR() to provide some basic Unit Testing functionality (as here), but I am frustrated by the inability to use FLOATs in the error message. I know I can cast the float to a string, but ...
15
votes
2answers
892 views

T-SQL query using completely different plan depending on number of rows I'm updating

I have a SQL UPDATE statement with a "TOP (X)" clause, and the row I'm updating values in has about 4 billion rows. When I use "TOP (10)", I get one execution plan that executes almost instantly, but ...