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)

0
votes
1answer
1k views

SQL update set column = @ parameter

doeas anyone knows how to update a table where column = @parameter WHERE SELECT Basically I have a table with the following values. Table name is UserAttribute ID|Name |Properties| ...
5
votes
2answers
733 views

Two corrupted indexes found by DBCC CheckTable

I'm wondering if this problem is solvable by dropping/recreating the two indexes. Both are rarely used, nonclustered, non PK, non FK indexes. Here is the dbcc output: Table error: table ...
4
votes
2answers
1k views

Track grant permission on tables

I'd like to see if there are any changes on the permissions granted for a specific table. For example, I don't want to have the login 'John' have the SELECT permission on the table Invoices. If ...
4
votes
1answer
1k views

Primary key with “NOT FOR REPLICATION” option

I have recently taken over a project, and I have discovered that in most tables the primary key has the property "NOT FOR REPLICATION". I'm no DBA, but surely in most databases, a record without a ...
1
vote
1answer
114 views

Public Database for Mobile Application

What are the proper steps to hosting a public database. Currently I a building a mobile application with Adobe Flash Builder. I have used Microsoft SQL Server, My SQL as well as WAMP Server. All of ...
1
vote
2answers
402 views

SQL Server Profiler 2005 on remote SQL Server 2008 Express?

Is it able to trace remote SQL Server 2008 using SQL Profiler 2005? If yes, anyone knows what else should I do, if during loging in appeares this message "Unable to locate trace definition file for ...
1
vote
1answer
2k views

how to add attachment(text file) to database mail?

I have scenario Daily i run a sql job to apply a new updates to one table - this job will create one text file daily - text file contains all new updates I can send a mail to client that job is ...
4
votes
1answer
75 views

Why is this user “Admin” created in all databases?

When I create database in SQL server Management Studio, user with name "admin" is also created for all databases: Why this user is created? And how I can change this behavior?
5
votes
2answers
646 views

In SSIS 2012, what is the purpose of flagging a package as an “Entry Point” package

In the Visual Studio designer you can right click on a SSIS package and designate it as an "Entry Point" package" Doing a search I found this page on MSDN which states: The value of 1 signifies ...
6
votes
3answers
3k views

Stop SQL Server service(s) before defragmenting drive?

Our production SQL Server 2005 database's data files live on a separate physical drive, which Microsoft Windows 2003's Disk Defragmenter tool reports as 99% fragmented. We scheduled a task to ...
1
vote
2answers
799 views

SQL Server deadlock too long [closed]

I have a really weird problem with a deadlock between a business process and a monitoring job. The both were involved on a deadlock that lasted around 5.5 hours. I don't know why SQL Server took so ...
1
vote
1answer
267 views

Effects of enabling service broker

I would like to use SqlCacheDependency to update a dataset in real-time, but we have not enabled the service broker on our production database. Could enabling the service broker have any adverse ...
0
votes
1answer
110 views

What index to add in case of join by two optional fields

I have query similar to the one below, it joins two tables by field which can have NULL value. The result matchs the data if both tables have the same data or consider the condition as optional. ...
0
votes
1answer
2k views

Granting permissions only on a set list of objects

I have a SQL Server 2005 database with a large number of tables in the dbo schema. I now created a new schema (call it myschema) that only has three table-valued functions and two stored procedures in ...
2
votes
0answers
80 views

How to safely take an SQL job out of the schedule?

There is a table | jobID | status | startTime | endTime | and a job, that is scheduled to run every X seconds, it will take the first undone job ID, put it in stored proc and run it. Stored proc takes ...
5
votes
1answer
1k views

Find transactions that are filling up the version store

we have enabled the "READ_COMMITTED_SNAPSHOT" for some of our SQL Server 2005 databases. Now from time to time we see that our TempDB is filling up the harddisk and we suspect the version store to be ...
2
votes
1answer
332 views

SQL Merge Replication: Cannot resolve conflict

I have a SQL Merge Replication over HTTP (Replisapi.dll). I'm not very familiar with the internas of the replication conflict solving because it was always working so far. Now I have two conflicts in ...
1
vote
1answer
604 views

SQL Azure: Drop Constraint and Index

This may be a stupid question, but I'm not a DBA and just wanna make sure of what I'm doing before I make a mistake. Here is my question: When dropping Constraints, are their indexes dropped as well? ...
5
votes
1answer
337 views

SQL availability groups log maintenance

I have a AG with 2 nodes in a site in sync mode and 1 offsite in async mode. I'm having trouble understanding how the logspace is maintained in this scenario. For instance, I'm taking log backups ...
2
votes
1answer
179 views

How do I know if my database partitioning is done well? [closed]

I have a sneaking suspicion that the guy who wrote the partitioning functions at my place of work did a fairly poor job. For certain queries (maybe 20% of them) we see incredible performance boosts ...
5
votes
2answers
722 views

Finding stored procedures with missing indexes

How to scan for stored proc that need indexes to be created. Anyone have any idea? Basically we have stored procedures that run very slowly. I'm wondering if there is some kind of automated script ...
2
votes
1answer
419 views

Storing multiple settings for multiple users in a SQL Server table

I'm using SQL Server 2012 to store the account settings for multiple accounts (each user account will have a set of settings). These settings could have any number of fields (has not been completely ...
5
votes
1answer
435 views

Does large table variables fill up logs in tempdb?

I'm running into an issue with a DBA who claims that table variables reside in ldf of the tempdb and when large amount of data is loaded into the table variable, the tempdb's logs fill up. The DBA's ...
1
vote
1answer
956 views

Creating indexes with t-sql scrips vs rebuild indexes in maintenance plan

I’m using SQL Server 2008 and I am running several (15) scripts each day to bulk insert to tables. Each script drops the table at the beginning. I create indexes in the scripts. Some of the scripts ...
1
vote
1answer
235 views

Moving site to amazon EC2 - better to have 1 large instance or 2 medium instances?

I currently have a website which is running on windows 2008 r2 standard along with sql 2012 express. All on the same box. The site gets around 700-900 visits a day,although that is slowly going up ...
1
vote
0answers
243 views

Why would running DBCC FREEPROCCACHE result in different data being returned? [closed]

I experienced a situation where a query run directly in SSMS was giving a different result set than the same query run from code on a web server, using the same database. After spending a lot of time ...
1
vote
0answers
55 views

Will Startup Procs Run Again After Database Recovery?

We have a number of stored procedures that run on startup via the sp_procoption startup: exec sp_procoption 'ProcName', 'startup, 'true' A customer's server started up with a very large database in ...
3
votes
1answer
221 views

Load Testing Crash Course

Can someone point me at a good resource to get a crash course in load testing. I have a sql server machine that I need to load test but I havent been thruogh the process before. Also we do not have ...
4
votes
1answer
78 views

Covering Index Question

I have the following query Select Pt.PRODID, PT.INVENTREFID, Inv.ItemName, PT.ItemID, Configid, Pt.QTYSCHED, PT.DLVDATE, Pt.CREATEDDATETIME, pt.SCHEDEND, CASE Left(PT.INVENTREFID, 3) WHEN ...
10
votes
3answers
2k views

Unique Identifier with Extra Characters Still Matching in Select

We are using SQL Server 2012 with a unique identifier and we've noticed that when doing selects with additional characters added onto the end (so not 36 chars) it still returns a match to a UUID. For ...
2
votes
2answers
804 views

Is there a way that I can export a list of all table triggers on a server?

I have two SQL Server instances that I manage. One is a SQL Server 2000 instance, and the other is 2005. Some where, on these servers, I recall setting up a couple table triggers that were executed ...
2
votes
1answer
848 views

How can I calculate time spent at work in a single column?

I would like to calculate the amount of time spent working from rows of data that contain a single date/time field. The first occurrence on a given day can be considered the start time, with the ...
3
votes
2answers
2k views

Why do I get “The initial snapshot for publication is not yet available.”?

We are using Transactional Replications with updatable subscriptions. 1 publisher, 1 subscriber. SQL Replication started encountering a constraint error on 3/6 at 10AM because people at two different ...
1
vote
2answers
117 views

Does this query make sense?

I recently migrated a database from Sybase ASE to Microsoft SQL 2008r2. One category of queries that was broken in transit is: SELECT person_id FROM leaveperiods WHERE group_id=146 GROUP BY ...
2
votes
3answers
18k views

List all permissions for a given role?

I've searched around all over and haven't found a conclusive answer to this question. I need a script that can give ALL permissions for an associated role. Any thoughts, or is it even possible? ...
5
votes
3answers
2k views

Linked server error not caught by TRY-CATCH

I am setting up a job to loop through a list of linked servers and execute a specific query against each one. I am trying to execute the query inside a TRY-CATCH block so if there's a problem with one ...
4
votes
3answers
361 views

Backup strategies for zero data loss

I am working on one project and it has around 100K records. We can afford a downtime of 1 day but we need the data to be always available to us in latest state. I've gone through two options: 1) ...
0
votes
1answer
45 views

Copy Permission From Windows Based user To Local user

I want to know if it is possible to copy the permissions of a windows user to a locally created user on SQL server?
13
votes
4answers
2k views

Is it possible to make one column readonly?

I'm curious if it is possible to create a table with a column that can never be changed, but the other columns of the table can. For instance I could imagine a CreatedByUser column that should never ...
3
votes
0answers
147 views

Key Lookup and Full-text index

I have the following query: SELECT T2.Title FROM TitleTable T1 INNER JOIN TitleTable T2 ON T2.FKID1 = T1.FKID1 WHERE T1.FKID2 = @ID_PARAM1 AND T2.FKID2 = @ID_PARAM2 AND ...
0
votes
2answers
326 views

Large time difference between two almost identical simple queries…why?

I'm trying to understand why is there so much difference in execution time and CPU usage between two simple queries that only differ in a computation. The queries are the following: SELECT ...
5
votes
2answers
188 views

Is it possible to enforce unique values in a column, excluding nulls?

I have a business requirement to have a FK field on TableA referencing TableB. If there is a value in TableBID, it should be unique, but it's not mandatory, so there could be multiple records with ...
1
vote
2answers
2k views

How to find DELETE and UPDATE statements that have been executed on a database?

I am trying to find out what delete and update statements have been executed on a certain database in a certain period of time. I came across this following query, but it generates an error message: ...
1
vote
1answer
205 views

Minimising downtime implementing merge replication on live system

Background We have three Servers running SQL Server 2008 which all contain a Product database. These are currently kept in sync once per day by sending a copy of the MDF to the two Subscribing ...
5
votes
1answer
4k views

Log Shipping - RESTORE WITH STANDBY - on SQL Server 2012 keeps breaking

We are using log shipping and RESTORE WITH STANDBY on SQL Server 2012 in order to restore the database in read-only mode for reporting purposes. However, the log shipping setup keeps breaking after ...
0
votes
1answer
741 views

SQL Server 2005 upgrade to Service Pack 4 (SP4) via command line

I have been wracking my brain over upgrading SQL Server 2005 to SQL Server 2005 SP4. I have a script for installing new instances of SQL Server for all versions and they all work wonderfully. Problem ...
1
vote
2answers
313 views

SQL Server 2005 upgrade service pack via command line

I have been wracking my brain over upgrading sql server 2005 to sql server 2005 sp4. I have a script for installing new instances of sql servers for all versions and they all work wonderfully. Problem ...
5
votes
1answer
1k views

Type conversion in expression may affect “CardinalityEstimate” in query plan choice?

I maintain an archive database that stores historical data in partitioned views. The partitioning column is a datetime. Each table under the view stores one month of data. We constraint the events on ...
3
votes
0answers
421 views

SQL Server Database Hot Backups: Which Technique(s) to Use for Multi-Level Replication?

I'm reading the many other posts here about mirroring vs. replication, but I'd still appreciate it if someone with some experience would weigh in. My small development team needs to have local ...
5
votes
2answers
1k views

Manually moving SQL instance to another node causes immediate database mirror failover

I have a two-node SQL cluster (2008 R2). Some of the databases within that SQL instance are mirrored to another server on a remote site, using the High safety with automatic failover. The mirroring ...