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)

5
votes
3answers
161 views

Schemas and user rights

I have 2 schemas, lets say sch1 and sch2. Each owned by different user. I do want to grant SELECT rights on sch2.MyTable (but just this one object) to sch1 procedures/views AND allow to reference ...
3
votes
3answers
2k views

SQL Server dates - can I get date and hour?

In SQL Server, can I do the equivalent of to_char(date_field, 'YYYY-MM-DD:HH24') in Oracle to get 2012-01-30:23?
3
votes
2answers
1k views

Would it be possible/wise to execute 2 parallel restores from a single backup?

Every night I create a backup (to disk) of a particular database. Subsequently that backup has to be restored to 2 different servers. These restores now happen sequentially and take about half an hour ...
1
vote
1answer
1k views

uninstalling SSRS and SSIS from clustered SQL Server 2008 R2 SP1

Due to the security recommendation, i will need to uninstall the unused SSRS and SSIS component from a production cluster SQL Server 2008 R2 SP1, so what is the caveats and what do I require to do to ...
0
votes
2answers
496 views

Merge Replication Subquery Filters

I am using merge replication with SQL 2012. I have a number of articles in my publication and will have to come up with quite an elaborate set of filters. If I add a filter on my article it can ...
9
votes
2answers
11k views

Suppress SQL Server Management Studio auto complete

Is there a way to temporarily suppress SQL Server Management Studio's auto-complete while typing a query? I don't want to disable auto-complete completely just say hold down some key while typing in a ...
4
votes
2answers
1k views

Should a table have a clustered index even if it doesn't have appropriate fields for it?

If you have a table without a good candidate field or fields for a clustered index (stable, sequential), is it better to have a clustered index on a bad field or is it better to make all table indices ...
2
votes
1answer
36 views

How to set the language of a doc to a DB field

Is there a way to set the language of a document body to a value fetch from the DB in SSRS? I tried with a simple expression and I got this error. I wonder what the best workaround is
3
votes
2answers
3k views

Will a delete then insert within a transaction cascade?

I had a question about what the expected and actual behaviour for the following scenario is. The scenario is one where a database table ([table1]) is cleared and reloaded every day. The table has an ...
2
votes
0answers
179 views

MDX Block Calculation Optimisation

I have a query I'm trying to optimise. I have read an article here http://web.archive.org/web/20100823233821/http://www.biblogs.com/2008/03/30/optimizing-countfilter-expressions-in-mdx/ about ...
4
votes
2answers
9k views

A Script to insert dummy Data in all tables of Database

I wanted a Script that can loop through all tables and their columns in the database and insert dummy data based on column type and size, so that i can start using the database for testing, and ...
2
votes
1answer
2k views

SQL admin Scripts - Enabling read only access to all databases

I would like a script that will allow our web developers read only access to all databases on our SQL server. Currently we are having to do this manually as we have no SQL expert / DB Admin. Would ...
4
votes
3answers
5k views

How to compare two SQL Server 2008 configurations

I have a problem with my application that works on my dev SQL Server 2008 (Developer Edition), but not on a production SQL Server 2008. Is there an easy way to export the settings from the production ...
2
votes
1answer
2k views

Looking for a Trigger to change inserting strings?

I have an MSSQL Server 2008 Database. There are some tables in my Database like below : table1, table2, table3, .... each table has a NVARCHAR(50) field (Name) Now, I wanna change the strings that ...
3
votes
2answers
465 views

Replicating a Table Structure With no Data Using Merge Replication

I am using merge replication with SQL 2012. I have a table, and it would be useful to propogate that table to the subscribers, but just the table structure, not the actual data. The data in the ...
7
votes
2answers
927 views

Is it safe to run antivirus software on my database servers?

Some implementations of antivirus software are known to Microsoft to cause a variety of problems for SQL Server, and Microsoft has a support article dedicated just to picking the right antivirus ...
4
votes
3answers
8k views

How to log error details when using using try/catch for dynamic SQL backup commands

When issuing a backup command within a stored procedure that uses a try catch and dynamic sql, the error messages are very general when compared to running the backup command directly. Try/Catch ...
8
votes
3answers
7k views

When should indexes be dropped and recreated?

We are constructing a data warehouse that initially will be 1 TB and will grow around 20gigs every month. For certain tables we are doing daily ETL processes and others we are doing weekly/monthly. ...
2
votes
2answers
912 views

Specify Values for Template Parameters — command

When I create a stored procedure in SQL Server 2008 by using the template, the comments specify a hot-key combination that no longer works: -- Use the Specify Values for Template Parameters -- ...
1
vote
1answer
907 views

Is it possible to do an in-place upgrade of SQL Server 2005 Standard to SQL 2012 Enterprise?

At the moment, I have a SQL 2005 Standard box. I'd like to upgrade it to SQL 2012 Enterprise in-place. When I say in place, I mean an install similar to Office 2010, e.g. it removes the older (Office ...
5
votes
2answers
1k views

SQL Server parallelism for DML operations

I know SQL Server can use parallelism for certain DDL operation e.g. index rebuild or certain SELECT statements mostly likely in a data warehouse environments when query cost exceeds cost threshold ...
26
votes
2answers
60k views

How to identify which query is filling up the tempdb transaction log?

I would like to know how to identify the exact query or stored proc which is actually filling up the transactional log of TEMPDB database.
7
votes
3answers
2k views

logical reads vs. scan count

I'm joining a small table (1,000 rows) against a large table (8M rows) in SQL Server 2008. The join uses a nonclustered covering index on the large table, and the join can produce three possible query ...
4
votes
1answer
327 views

Check Index Fragmentation on SQL Server Audit Queues

I've read this excellent article, http://rusanu.com/2010/03/09/dealing-with-large-queues/, and seem to be having the same issue, due to a low space issue, the service broker was turned off on a ...
2
votes
6answers
742 views

What are the advantages of having a centralised SQL database server for development?

I have an idea to use for my fellow developers and basically wanted feedback. The idea is to have a centralised SQL Server database server for all developers to use. Each developer would have either ...
0
votes
2answers
5k views

Extract mdf & ldf files from backup file?

Is there a way to extract SQL Server files (.mdf & .ldf) from a backup file (.bak) to a physical location, without restore database? I need a restore query or script to restore files from bak ...
2
votes
1answer
240 views

Why CDC records nothing while being enabled?

I enabled Change Data Capture on some tables in a Microsoft SQL 2008 database. Both of the following queries return 1: select top 1 is_cdc_enabled from sys.databases where name = ...
2
votes
1answer
636 views

How to avoid duplicating information in a series of nested SELECT statements?

I'm working on an SQL query that puts together customer history based on past purchases (the industry is venue ticketing). The report will be LARGE, something like 80-90 columns, with one column per ...
2
votes
1answer
3k views

Cannot fetch the rowset from OLE DB provider “SQLNCLI” for linked server X

I am getting this error while doing concurrent read from same table through linked server. Time out setting is alright. When this error happens, I also start getting the following error for the same ...
9
votes
2answers
46k views

How do you grant execute permission for a single stored procedure?

Normally when I create a stored procedure I use the following as a template of sort Create procedure <procedurename> <@param1 <type>, @param2 <type>, etc..> as begin ...
5
votes
3answers
469 views

Is it possible to recover day's worth of queries from sql server log file?

I lost all data entered and edited in my system yesterday, and my ISP has announced to me that last night's backup is corrupt and cannot be recovered. Is there any way to access the database's log ...
3
votes
1answer
3k views

Problem restoring a database in SQL Server

I am trying to follow the instructions on the following post: http://stackoverflow.com/questions/10299811/creating-new-database-from-a-backup-of-another-database-on-the-same-server To summarize; I ...
4
votes
3answers
100 views

SQL Server Table Move Stalled

I'm running a data migration. The process is moving data from a query on a SQL Server 2005 database to a SQL Server 2008 R2 database single table destination. The source query is a join between 2 ...
3
votes
1answer
1k views

Database Mail to Distribution List

I have a SQL Server 2005 which I have configured the database mail to setup monitoring alerts and notifications. I also create a email distribution list containing a couple of emails. The thing is ...
1
vote
1answer
656 views

Return a percentage of the full record set

I'm pulling back a list of orders but I need to only display a percentage of the records. for example we want the top 30 or top 50. The percentagbe is variable so I'd like to not use TOP. I tried ...
5
votes
4answers
9k views

Copy Database option not found in SQL Server Management Studio 2008 R2

I am unable to see the Copy Database option in SQL Server Management Studio 2008 R2. Can anyone tell me whats going on please?
0
votes
2answers
948 views

How to move all non-unique and non-clustered indexes to a different filegroup?

I want to move all indexes to a separate hard drive. To that effect, I created a new filegroup, then added a new file to it (e.g. alter database foo add file(...) to FileGroup). Now I want to move ...
1
vote
1answer
183 views

Hard Drive Configuration for my setup

I have a fairly large transactional database (100GB) with a lot of users. The database access is solely via stored procs that make heavy use of temp tables, table variables, cursors and other fun ...
4
votes
1answer
496 views

hostname incorrect in sysprocesses

I'm running SQL Server 2000. While doing some profiling to trace activity, I noticed some hostnames showing up that were mysterious -- names that shouldn't exist on the network anymore. I got the MAC ...
5
votes
2answers
2k views

Transaction Log and mirroring - looking for dumbest explanation possible

First of all I must admit that I struggle with concept of Transaction Log. I mean - I do understand that it is Log of all Transactions that happen on database, but when it comes to properly putting it ...
5
votes
1answer
2k views

NESTING_TRANSACTION_FULL latch

Production SQL Server 2008 performance is far below expectations. Simple single-table queries sometimes are working for 5 seconds in the mid-day compared to 250ms after hours. We cannot find which ...
5
votes
2answers
673 views

SQL to select random mix of rows fairly

Here's my problem: I have a set of tables in a database populated with data from a client that contains product information. In addition to the basic product information, there is also information ...
1
vote
1answer
2k views

MDX - Sum values greater than then a median calculated measure

I'm relatively new to SSAS / MDX. I have a cube with a calculated field which calculates the Median value for a range of prices. MEDIAN( [DimItems].[Dim Items Id].CurrentMember.Children, ...
2
votes
1answer
221 views

Indexing or changing one-to-many relationship

I have these two Microsoft SQL Server 2005 tables: ObjectLicenses (ObjectLicenseID [PK]; ObjectID; LicenseType; LicenseNumber) 1|1|A|000001 2|1|A|000002 3|1|B|000003 4|2|C|000004 Objects (ObjectID ...
2
votes
2answers
2k views

SQL Server 2008 linked server to an Access 2007 DB that is in a protected directory on the Network

We have a SQL Server 2008 database that we are attempting to link with an Access 2007 DB (the maintainer works down the hall and refuses to migrate to SQL Server). We have the password to the database ...
6
votes
4answers
5k views

Passing in the table into a stored procedure

Is it possible to pass in the name of a table into a stored procedure? For example, suppose you have several views of the same table. They all have the exact same structure. You want a store ...
2
votes
1answer
1k views

Bitwise operators affecting performance

I have recently seen some stored procs coming my way that contain BITWISE operators that are causing the optimizer problems. I know from playing with execution plans that these are the cause of the ...
8
votes
2answers
8k views

How badly do SQL Compilations impact the performance of SQL Server?

I am profiling an instance of a SQL Server 2005 and I, via PerfMon's SQLServer:SQL Statistics - SQL Compilations/sec metric, I see that the average is about 170 or so. I whipped out SQL Profiler ...
4
votes
2answers
867 views

Massive peer-to-peer replication topology?

We have a client that's geographically distributed in remote communities, with somewhat unreliable network/internet connectivity between each of the physical locations. There is a single central ...
2
votes
3answers
383 views

Capture all queries that use hints

How can I capture or list all queries that use hints and have executed since the last instance restart? I am using SQL Server 2005 Standard Edition.