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)

3
votes
1answer
3k views

Disable SQL Server Log Shipping to nonexistent destination

I am administering a SQL Server 2008 instance in a dev environment. At some point before I became an administrator, someone enabled log shipping from one of the databases on this dev instance to ...
2
votes
2answers
2k views

Replace the server name in email sender address when sending email from SQL Server 2008

I'm sending emails directly to Microsoft Outlook accounts from SQL Server 2008. Everything is fine, email was sent. Only problem is that in the header of the email the SQL Server name is embedded. ...
2
votes
1answer
464 views

how to restore database from other server - sql

I have backup database from server A. Then I want to restore it in server B. I have manage to restore it, but I cannot connect to it when running my VB program. I already change the configuration ...
2
votes
2answers
648 views

SQL Server Backup Sizes Differential, Compressed Backup Sizes

I'm trying to backup my organization's production databases on SQL Server 2008 R2 Standard. I'm using a T-SQL script to backup with DIFFERENTIAL and COMPRESSION selected. I'm astounded at the size ...
5
votes
1answer
193 views

Composite or Single-Field Clustering Key

My DBA and I are having a disagreement on index structure. Consider data for a medical claim... We have the Header table with fields like: ClaimId (varchar(50)), PaidAmount, MemberID... and for ...
5
votes
2answers
191 views

How the indexes are managed?

I am trying to understand how the indexes are managed for below common data types: 1- Numeric (Integer, Decimals) 2- String (Varchar, Char) 3- DateTime I have few questions: 1- How the indexes are ...
1
vote
3answers
436 views

SQL Server 2008 eval expired

I have (more than one instance) some of my experiments with SQL Server 2008 eval (why eval --> brutal bureaucracy about using licenced version for testing or short life-cycle experiments), and after ...
1
vote
1answer
724 views

Replicate/Mirror SQL Server schema to slave databases

I have a empty database called MASTERDB and around 10, or more, slave databases that are copies of the MASTERDB database. MASTERDB will be always empty, as I only need the schema. No data is going to ...
3
votes
2answers
2k views

Default SQL Server 2008 locking behaviour

I am using SQL Server 2008. What is the default lock behaviour with UPDATE? NOLOCK? ROWLOCK? PAGLOCK? How can I tell what the current level of lock is for a table? Thanks, Bruce
6
votes
1answer
4k views

Whats the difference between Transaction logs and Binary logs?

Coming from a SQL Server shop, I now work with MySQL and I was curious. What are the differences between MySQL's binary log and MSSQL's transaction log? By the outlook thus far, it seems that there ...
8
votes
1answer
4k views

Is it possible to create an alias or synonym for a database?

Is it possible to create a database alias or synonym? What I am hoping to be able to do is have NewDatabaseName aliased as OldDatabaseName to prevent having to rewrite a ton of code. Backstory: I ...
2
votes
1answer
230 views

MDX misunderstanding: complex FROM clause

I have a MDX query which syntax is familiar to me: SELECT NON EMPTY { [Measures].[Amount] } ON COLUMNS, NON EMPTY { ([Projects].[Id].[Id].ALLMEMBERS * [Priorities].[Id].[Id].ALLMEMBERS ) } ...
1
vote
4answers
862 views

Top 2 rows per partition from an absolute value date difference

I have a database of security camera footage in a denormalized database. I have Locations which have multiple Cameras which take multiple images. Location + Camera + image capture_date is the ...
1
vote
1answer
4k views

How do I allow Service Broker access to Master Key of database?

I am trying to set up SqlDependency on my dev system. The db on my system is a few months old production db which I have attached. When running SqlDependency from ASP.NET application, I see the ...
2
votes
1answer
136 views

Is execution of synonyms not logged in target database?

I've been working on an issue where a single select within a stored procedure failed due to permission-issues, and we traced it to a call to a Synonym: USE DatabaseA GO CREATE SYNONYM ...
4
votes
3answers
5k views

Stored procedure executes too long

We use SQL Server 2008. When I am watching in SQL Server Profiler I found some queries that take for example 20 seconds. The same query (in a stored procedure) when executed in SQL Server Management ...
1
vote
1answer
170 views

Foreign key to subtype or super types?

I'm using SQL Server and in this case i have the following tables: Restock: Foreign key to an R&D Staff member R&D_Staff: subtype from Staff Sales_Staff: subtype from Staff Shipping_Staff: ...
1
vote
1answer
1k views

SQL-Server: sp_spaceused gives zero rows but big dataSize for cleaned table

After cleaning my table with DELETE FROM MyTable (and executing DBCC shrinkdatabase('MyDB') should that matter) I run the statement EXEC sp_spaceused MyTable. The results confuse me: tableName ...
7
votes
3answers
25k views

How do I run a batch file from a scheduled Job via SQL Server Agent

I'm attempting to run a (Windows) batch file from within a SQL Server agent job under SQL Server 2008 R2. In the Job Steps, I've created a new step, set its type to "Operating system (CmdExec)". I ...
2
votes
1answer
559 views

SQL Server 2008 - Return records in chronological order, given a separation factor

This question was originally posted here http://stackoverflow.com/questions/8492149/return-records-in-chronological-order-given-a-separation-factor and re-posted on this forum given a user's advice. ...
8
votes
2answers
595 views

How does SQL Server determine the order it takes locks in while selecting a table?

I have two stored procedures that are deadlocking when the system is under load. Proc A is selecting from a table while the Proc B is inserting into the same table. The Lock Graph is showing that Proc ...
1
vote
1answer
926 views

Syspolicy_purge_history connection issue

I am having an issue with the syspolicy_purge_history SQL Agent job on a 2008 SQL Server system. The server is using a non default port number and is in a cluster. Before it was put in a cluster, it ...
6
votes
2answers
2k views

SQL Server Partitioning vs Indexes on Separate Filegroups

I am just about to start on an excercise to reorganise a partitioned table and I was looking for best practises or recommendations. Let us say I have a billion row table and 8 logical disks available ...
6
votes
1answer
11k views

Database 'MyDb' is being recovered. Waiting until recovery is finished

I got so error: Database 'MyDb' is being recovered. Waiting until recovery is finished. I have had a critical operation at that time. What is the cause of this situation? And how can it be ...
1
vote
1answer
2k views

How to move data from Primary Data File to other data file without destroying replication

I have one Database which is replicated using transactional replication. Now, I want do spare some data of that database to another partition, because my server running out of disk space. I was ...
2
votes
5answers
4k views

Keep transaction log size under control during batch processing

tl;dr I think my verbosity has obscured the real question I'm asking here, so I apologise for that. My main issue is that the checkpoint command appeared to be working for at least 800 iterations of ...
2
votes
3answers
786 views

Column sort order in CREATE INDEX statement?

When creating an index one can determine if an index column is sorted using ascending or descending order. BOL says that [ ASC | DESC ] Determines the ascending or descending sort direction for the ...
3
votes
1answer
163 views

SQL Server - Using spatial data

I'm using SQL Server 2008 R2 for real-time location aware service. The service mostly receives location data (lat/lon) from a user and returns locations around the user. The data is being sent from ...
2
votes
5answers
7k views

Small sample database for practicing database administration?

I'm looking for a portable sample database that can be created from a script has a simple ER model has little data for database administration practicing purposes. I know that there is e.g. ...
2
votes
2answers
2k views

6th normal form, Recomposition query, efficient implementation

I found this paper written by Hugh Darwen for avoiding nulls in my database: Link, It describes how to implement databases in the 6th normal form so you can avoid nulls. The logic is described in the ...
0
votes
1answer
197 views

Multiple Partition Keys?

This is a follow-on from a previous question. I've never worked with SQL Server partitioning but I currently faced with designing a database for which the volumes probably warrant it. The system is ...
2
votes
2answers
5k views

Should I lock the table during delete

I have a table that has 4 million records. It has a clustered index on a date column (record creation date). It has 5 tables reference this table, all have FK indexes. The machine has no down time. I ...
1
vote
1answer
372 views

What is the effect on primary keys when moving a CLUSTERED index to a new filegroup?

I'm moving a CLUSTERED index from one filegroup to another, using the with drop_existing=on functionality. Do I need to be concerned about primary keys? In other words, is there some special ...
3
votes
1answer
636 views

How to find what tables are stored in what data files

I know that tables can span across multiple data files The tables are already created. I did not create them myself. I'm trying to find out what table(s) are using the highest amount of IO. I was ...
1
vote
1answer
1k views

SQL Server 2005/2008 logging connections

How can I audit SQL connections to the database from Windows credential Sql Users Is there some built-in feature where I can determine number of: all connection active connection unclosed ...
6
votes
2answers
1k views

Benefits of making a sql server database as read-only?

I am using a reporting database which for all practical purposes is a read only database. It is created data and dynamic reports are generated and viewed on this database. I was thinking of making ...
6
votes
3answers
303 views

Query performance

Why SELECT Barraportfolioname FROM portfolio WHERE id IN (SELECT DISTINCT i1.portfolioid FROM Import i1 LEFT OUTER JOIN Import i2 ON ...
3
votes
1answer
838 views

SQL Server Alert Based On Severity Level Not Working

I am new to SQL Server alerts, and I am trying to setup an alert That will run a job and send a notification, based on severity level. In order to test if the alert works correctly I have downloaded ...
3
votes
1answer
2k views

What does Error: 17828, Severity: 20, State: 4 mean?

I've found this guy in my SQL log: "The prelogin packet used to open the connection is structurally invalid; the connection has been closed. Please contact the vendor of the client library. [CLIENT: ...
16
votes
4answers
11k views

Should dbo schema be avoided?

When it comes to the dbo schema: Is it a best practice to avoid using the dbo schema when creating database objects? Why should the dbo schema be avoided or should it? Which database user should own ...
2
votes
2answers
115 views

SQL index with additional includes

In an effort to be more efficient when creating a new index, if there is already an index with the same index keys, but it simply needs additional include columns, is it better to create a second ...
10
votes
6answers
6k views

Suddenly Slow Execution Plan for Stored Proc

I'm trying to understand an issue we're having with SQL Server 2000. We are a moderately transactional website and we have a stored proc called sp_GetCurrentTransactions which accepts a customerID, ...
5
votes
2answers
301 views

If a query triggers a statistics update and times out are the statistics still updated?

I have a fulltext query which is usually very fast but may time out when it causes a statistics update since statistics updating is very slow on this database. Usually the query "recovers" to normal ...
0
votes
1answer
142 views

Set timeout expiration in ms sql 7

I'm trying to perform a query in a transactional database that was used for more than 3 years. But it always says timeout expired after running for about 30 seconds when I try to run this query: ...
11
votes
1answer
2k views

Why is Clustered Index Scan Number of Executions so high?

I have two similar queries that generate the same query plan, except that one query plan executes a Clustered Index Scan 1316 times, while the other executes it 1 time. The only difference between ...
1
vote
1answer
805 views

Can't run query using “localhost\sqlexpress”

I am trying dynamically build an SQL Statement that includes linked server. That works. When I use "localhost" to reference the current local machine SQL Server, that doesn't work. For example: ...
4
votes
2answers
1k views

SSAS queries time out when Windows File System Cache drops

We have a SQL 2008 Analysis Services instance on Windows 2003 that is experiencing near-daily performance issues (query timeouts) during peak activity. A second identical instance queried from the ...
3
votes
3answers
2k views

Unable to get DBMail working on SQL Server 2005

I have SQL Server 2005 SP3 (4053) running on a Windows Server 2003 R2 virtual machine. When trying to send a test dbmail message, either from the SSMS GUI or using sp_send_dbmail, I get the ...
3
votes
1answer
267 views

Does blocking always mean open transaction?

This may seem a bit dull question but does blocking always mean that there is open transaction and that may cause transaction log grow to infinity because open transaction prevents log truncation ...
5
votes
1answer
332 views

What 'resets' the transaction log

My question might sound rather strange but I'm not really a SQL expert and I can't find the answer.. I'm trying to create a backup plan which creates a full backup twice a day. A differential back-up ...