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
3answers
160 views

Determining if indexes are redundant

I have a table with the following structure: Id (int identity PK) FooId (int FK) BarId (int FK) QuxId (int FK) Other fields The following indexes have been defined: PK (Id), clustered Index1 ...
3
votes
0answers
119 views

How to Audit for Access with Cross Database Ownership Chaining

I've just joined the data team of a new company and we have a large SQL Server environment (100+ instances) and cross database ownership chaining is on by what I gather is a necessity. I'm looking for ...
1
vote
1answer
1k views

Can't grant role permissions under sysadmin login

I'm trying to execute this script from Management Studio: GRANT ALTER ON ROLE::[AdaptTemplate] TO [AdaptAdmin] AS [AdminSapr] Execution fails with this message: Msg 15151, Level 16, State 1, ...
4
votes
3answers
1k views

Logging query text without Profiler

I'm in the process of porting an old, semi-broken ASP.NET/SQL Server application to PHP/PostgreSQL. Among the torments^H^H^H^H^H^H^H^Hchallenges I'm faced with is that the reporting is done by a ...
5
votes
1answer
627 views

Why isn't partition-level lock escalation the default?

In SQL Server, locks are normally escalated from row or page -> table. Starting with SQL Server 2008, a new level of lock escalation was added - partition level. However, this isn't automatically ...
3
votes
0answers
291 views

MS DTC errors on SQL Server 2008 R2 but not SQL Server 2000 running on difference instance

I am receiving errors when I try to run a distributed query against different SQL Server 2008 R2. At first I thought this might be cause the servers have been set up on a VM using a clone but after I ...
-2
votes
1answer
376 views

Missing quotation - openquery to oracle [closed]

I am not able to successfully run a code with openquery to a oracle server. Please do not take into account field names/data types, as I had to present only a part of the whole procedure. It's quite ...
5
votes
1answer
323 views

Multi part identifier in Microsoft SQL Server

I'm migrating a SQL Server 6.5 database to SQL Server 2012. Migration went well but one of the software using this database performs a strange query: UPDATE myTable SET Field1='',Field2=0, ...
5
votes
1answer
2k views

Appending backups while overwriting expired sets

I've been reading up on this, but the online documentation is a bit difficult to understand and seems awkwardly written. For example the INIT, NOINIT. One says it will try to overwrite everything. ...
0
votes
1answer
269 views

Group By - Incorrect syntax near 'mycolumn' [closed]

I'm getting a syntax error in SQL Server Management Studio (SQL Server 2008) for the following query: SELECT MIN(EffectiveOn) AS EffectiveOn, Address1, Address2, Address3, ...
1
vote
1answer
1k views

SQL Server Full-Text Indexer with stoplists/stopwords

As I'm working on a graduate project (Textmining with SQL Server 2012 Semantic Search) I run into a situation where I need to post a question on this website, hoping someone can help me. This ...
1
vote
1answer
551 views

How can I stop SQL from validating an OPENROWSET query when its not going to be executed?

I have a problem where a stored procedure is throwing an error because it's trying to run/validate an OPENROWSET query inside it that it doesn't actually have to execute. The stored procedure that ...
2
votes
2answers
113 views

Joining 4 tables and 2 counts

I have four tables. UserMaster ---------- UserKey - PK UserName UserID - UNIQUE UserLogTransaction ------------------ UserID - FK:UserMaster.UserID LoginTime LogoutTime CallCenter ---------- ...
5
votes
2answers
3k views

Logins aren't syncing across Availability Groups

We have 2 servers in an AlwaysOn group. While the user accounts within each synchronized database exist on both servers, the database instance level logins only exist on one of the servers. Ie ...
1
vote
1answer
558 views

How can I restore the sql_variant_property of baseType back to a table variable in SQL Server

Ok, I know the title is confusing but here it goes. BTW I am using SQL Server 2008 I have a table that I am trying to use as a storage container. It has 3 columns: reportID integer, dataLabel ...
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 ...
2
votes
1answer
3k views

What are SQL Server Securables?

I migrated two applications to the new server. One of the them works without any issues but the other ran into back end sql permission problems like The EXECUTE permission was denied on the ...
2
votes
2answers
312 views

Execution plan flips Filter and Execute Scalar when using the PK, causes cast to fail

I have some data tables that where imported in from a flat file source so everything is varchar(max) except FileRecordID which is a int that hold the row number the data came from in the flat file ...
1
vote
1answer
318 views

SQL Server Replication tools

We're trying to create an exact copy of our prod database to later use it for reporting. I was told that some of my colleges tried to use the out of the box replication tools that SQL Server provides ...
8
votes
1answer
1k views

SQL Server Index vs Statistic

What are the differences between CREATE INDEX and CREATE STATISTICS and when should I use each?
2
votes
1answer
1k views

How to determine the read / write ratio of your server?

When looking at the read / write ratio of your server would you look at the NUMBER of reads and writes or the number of BYTES read and written? For example, consider the following numbers from ...
3
votes
1answer
1k views

Generate insert statements for table AND related data

I'm looking to move data from tables and related tables between 2 databases. The trouble is the primary keys are out of sync. Is anyone aware of a tool which can generate insert statements for a ...
1
vote
1answer
168 views

Binding errors with dependent stored procedures

We are getting strange errors on one of our stored procedures. This stored procedure calls other stored procedures & we are getting errors relating to columns that cannot be found in the sub ...
4
votes
1answer
299 views

I need help using hierarchyid datatype and requiring a unique constraint on a varchar field

I want to resolve a bunch of tables that had parent->child->grandchild relationships into a single table using hierarchyid identifiers. Here is what I came up with based on what I had. CREATE ...
62
votes
3answers
51k views

Why Does the Transaction Log Keep Growing or Run Out of Space?

This one seems to be a common question in most forums and all over the web, it is asked here in many formats that typically sound like this: In SQL Server - What are some reasons the ...
1
vote
1answer
275 views

SQL Server 2005 merge replication failure

We have a customer who, when trying to sync a client (subscriber) to the server (publisher,) receives the following error: 2012-11-30 21:03:33.334 Percent Complete: 18 2012-11-30 21:03:33.334 Data ...
2
votes
3answers
2k views

ASPState Log file growing tremendously - SQL Server 2008

Microsoft SQL Server 2008 (SP3) - 10.0.5500.0 (X64) Web Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) I have an ASPState database online, and its log file ASPState_log is growing ...
-3
votes
3answers
2k views

Join tables on a partial string match

input: I have a table containing (any number of) user-supplied strings: ╔═══════╗ ║ Value ║ ╠═══════╣ ║ To ║ ║ An ║ ╚═══════╝ And a table of user details: ╔════════╦══════════╗ ║ UserID ║ ...
5
votes
2answers
5k views

Separate stored procedures for inserts and updates?

I have a table in Microsoft SQL Server. Sometimes I need to update, and sometimes I need to insert. I could write 2 stored procedures: InsertNewPerson UpdatePertsonById But I was thinking to write ...
6
votes
1answer
423 views

Estimated versus actual query plan with function calls

I have this query on SQL server, a merge replication query: SELECT DISTINCT b.tablenick, b.rowguid, c.generation, sys.fn_MSgeneration_downloadonly ( c.generation, ...
3
votes
1answer
938 views

Performance effects of database file size and available space

I have set the autogrowth and maxsize properties to: By 10 MB, Unlimited When I look at the Properties -> General Tab by right-clicking the database in SSMS, I see the file size is 2249MB with 6.1 ...
2
votes
1answer
172 views

Shrink a large log file for a “Throw Away” database

I have a copy of my prod database on a development server. I am using it to test a deployment script. But when I run it, it says that the log file is full. I checked and it is at 10 GB (Almost the ...
1
vote
1answer
243 views

Correct Selection of SQL server instance db owner login name

I am attempting to connect RSA Archer (5.2) to an instance of SQL server 2008 r2 on WS 2008 R2. When Archer attempts it's initial connection I get - The ConnectString property has not been ...
2
votes
1answer
573 views

Only a single WITH MOVE clause should be specified for any logical file name

I'm trying to do a copy database by scripting a backup and restore. I have the backup procedure working correctly but I keep getting the error Conflicting file relocations have been specified ...
21
votes
3answers
10k views

Is the SQL Server Express memory and CPU limit per instance?

If I have 8GB of RAM in a server and I run 4 instances of SQL Server Express, will the total memory limit used by SQL Server be 1GB or 4GB? Would it be advisable to run multiple instances like this ...
2
votes
5answers
6k views

Is it possible to shrink an .MDF file on a drive with low free space?

Is there a way to shrink mdf file of database in SQL Server 2008 without using additional space? Total space in hard disk is 136 GB, the .MDF file size is 124 GB, and the log file size is 2 GB. I ...
4
votes
1answer
2k views

Agent job will not run

I created a JOB to run a simple package that runs a query and saves the results to an Excel file. If I try to run the job In SQL Management Studio I get an error saying: SQLServerAgent is not ...
10
votes
1answer
5k views

SQL query for combinations without repetition

I need a query which can be used in (or as) a function and retrieves all combinations of n values. And I need all combinations of length k where k = 1..n. Extended sample input and result so input ...
2
votes
1answer
163 views

User already exists error

I've created a stored procedure that creates a database, creates a set of tables, copies all of the data from a linked access database into those tables then creates a user and assigns that user to ...
11
votes
1answer
2k views

Is it possible to record incoming parameter values in a procedure call while tracing in SQL Server Profiler?

Using SQL Server Profiler (I'm on SQL Server 2012), I'm trying to generate a useful trace that shows the parameter values, not just the SQL with variable names. The stored procedure walks through a ...
5
votes
2answers
1k views

considerations when using triggers on a replicated (target) database

Our SQL Sever 2008 application database is replicated from Server A to Server B (push replication). We use the copy, let's call it database_b, on Server B to create reports and run other queries so ...
1
vote
1answer
346 views

Microsoft Synchronizer Framework

I'm planning to synchronize a pc that has SQL Server 2008 running on it, and the server has a SQL Server 2008 R2 running on it. Are there going to be any problems with data loss or compatibility?
7
votes
1answer
9k views

Login failed for user - Error 18456 - Severity 14, State 38

Message that SQL Server Log File Viewer shows: Login failed for user [User] Error: 18456, Severity: 14, State 38 What it actually means: Failed to open the explicitly specified database My ...
1
vote
3answers
191 views

Check of SQL Server upgrade success

I have performed SQL Server upgrade from 2005 to SQL Server 2008. Is there any tools/possibilities to check, whether the upgrade from SQL Server 2005 to SQL Server 2008 has been accomplished ...
10
votes
1answer
3k views

SQL Server Cache Flush and Disk I/O

We're busy load testing an OLTP system we've developed in .NET 4.0 and runs SQL Server 2008 R2 in the back. The system uses SQL Server Service Broker queues, which are very performant, but we are ...
4
votes
2answers
148 views

We are running database maintenace with indexing the system, indexing fails due to locking?

We have been trying to do re-indexing in our system, there are users still using the database during the indexing. While doing index for certain tables there is failure of indexing this seems to be ...
5
votes
1answer
764 views

Transactional Replication not sending all commands

I have a transactional replication topology as follows: NY Publication Database same server holds distributor NY - Subscriber LON - Subscriber HK - Subscriber We are using bog standard, one-way ...
5
votes
1answer
2k views

Why SQL Server doesn't support foreign key constraints on views?

I know that SQL Server doesn't support using a view as the reference for a foreign key constraint, is there a reason (i.e. something to do with the relational model) this is the case? It seems like ...
4
votes
3answers
1k views

Rollback group of DDL statements

Working in SQL Server 2008 R2, I am trying to rollback a set of DDL statements as a group (think of an upgrade script for a database), but am running into trouble. Take the following code: begin try ...
5
votes
3answers
11k views

T-SQL query to report disk space allocation and used space for auto-grow SAN databases

We are using 6 databases in total for an application, and we can only share 4TB of space for all 6 databases (via SAN storage). I'd like to write a query (report) for a single database indicating the ...