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)

6
votes
2answers
2k views

SSRS appears to be ignoring Permissions set using Report Manager

I have setup SSRS on SQL Server 2008 in native mode. As an administrator I can login to report manager, upload reports and run them, and also use the Web Service URL to generate reports. I have also ...
2
votes
2answers
216 views

Using data from other database to populate a new database

I have a SQL Server database DB1 and want to move data from DB1 to DB2. But only want some of the data to be moved. I want all the rows from DB1 that have a catParent that is the same as I Id from ...
19
votes
1answer
1k views

Cast to date is sargable but is it a good idea?

In SQL Server 2008 the date datatype was added. In this Connect item you can see that casting a datetime column to date is sargable and may use an index on the datetime column. select * from T where ...
3
votes
1answer
573 views

Cannot delete publication

When attempting to delete a publication, I am getting the error cannot drop publication 'XX' cannot drop article 'XX'. The subscription has been deleted at the subscriber. Any ideas on how I can ...
2
votes
1answer
685 views

SQL Server - storing ulong as primary key

I need to store ulong values as a primary key in SQL Server. Since SQL Server doesn't have a ulong datatype (or for that matter anything unsigned), the only way to go is to have column as ...
2
votes
2answers
135 views

SQL Server: reset all database tables

I have a SQL Server 2008 R2 database with about 60 tables and around 300 columns. I want to reset all the data and auto increments, I found a question somehow similar but the answer there is to ...
3
votes
1answer
108 views

Dissecting Joins

Recently I asked a question in dba.stackexchange the question was about data hierarchy in sql and a guy named chris allen answered the question and I really loved it but when I try to understand that ...
1
vote
2answers
264 views

Select Into a table on server1 from server2 without using 'Linked Servers'

I am trying to get all the records from one table into another table but these tables (which are identical) are on separate servers. Any help would be appreciated. Thanks
1
vote
0answers
956 views

How to return all values from a stored procedure casted as varchar(max) in sql server due to PHP mssql_query() ntext issue?

This is more of a concept/how-to question rather than about actual code. I can do the programming but I just need to know what direction to head... I was going to post this on StackOverflow but it's ...
2
votes
4answers
9k views

Get counts grouped by month and year

I am trying to report on data in e-email messaging system and wanted to have SQL tally counts by month/year. SELECT YEAR(crdate) AS y, MONTH(crdate) AS m, COUNT(*) AS tally FROM ...
2
votes
0answers
61 views

What is correct process to physically move an availability replica to another location

Current situation is we have 3 SQL Servers with one availablity group and we plan on moving one of the secondary replicas out of HQ to another location. There will be the span of a few hours between ...
0
votes
1answer
82 views

SQL Server 2008 Mirroring

How would one start the secondary mirror instance if the principal SQL server instance went off line?
4
votes
1answer
200 views

What is the importance of customized data spaces in SQL Server and what are the quantitative measures that can be used to efficiently design this?

I am curious as to what are the advantages of creating custom table spaces for Microsoft SQL Server 2008. As of now, and based on my limited experience all I can really tell/assume are the following ...
0
votes
1answer
277 views

Installation of SQL Server 2012 does not contain Virtual Interface Adapter?

I have installed the entire Enterprise edition of SQL Server 2012 and have noticed that I do not have the Virtual Interface Adapter. What is the cause of this?
-1
votes
1answer
70 views

Total of Same Customer ID from a Single DB Table [closed]

I have a table with multiple customers. Each customer has a unique ID. Example, only one customer has ID as CustomerID = 100. The customer can be entered into the table numerous times but the ...
1
vote
2answers
222 views

Database Is In InRecovery Mode.

I have a database that has entered "Recovery Mode". It was working fine, but ended up in this status a few days ago. I have been told that a cause can be the partition holding the datafiles running ...
1
vote
0answers
162 views

How to model Week Commencing / Week Ending scenario

I’m reasonably new to data warehousing and I’m struggling to get a feature of my time dimension working. I’d like to model a Week Commencing and Week Ending type of scenario. I’ve created a DimTime ...
1
vote
2answers
122 views

Who changed the size of the transaction log?

Can I know, who and when changed size of database transation log?
3
votes
1answer
152 views

SQL Database automatic back up

I have an SQL database - I need to back it up everyday (at a minimum) - preferably multiple times a day - automatically so it definitely gets done. I'm running Windows which the SQL database is ...
6
votes
2answers
6k views

Restore database from backup file of different version / edition

I read that it's possible to restore a database in SQL Server as long as you're restoring from an older version to a newer version, for backwards compatibility reasons. Does anyone know off hand if ...
4
votes
1answer
761 views

Slow SQL Server query using a DB2 linked server in virtual environment

I have a problem with a slow query which uses a linked server. Let me list out my environment first and I'll get to the issue: Virtual Windows 2003 R2 server (fresh deployments on XenServer 6.1 ...
0
votes
1answer
891 views

Downloading image data type contain to desktop SQL Server 2008

I am very new to SQL Server 2008 and question may look very basic to gurus. Following in the problem universe. I have a huge (600 GB size) SQL Server 2008 table that stores pdf files in a column ...
1
vote
3answers
10k views

Non-Clustered-Index on a temporary table

I am working on various query optimization techniques. I reduced the query execution time from 1 minute to 12 seconds just by adding a Non-Clustered-Index on a table including one column (which is ...
3
votes
1answer
669 views

Index Key Column Order

I have created a joining table for many-to-many relationship. The table only has 2 cols in it, ticketid and groupid typical data would be groupid ticketid 20 56 20 87 20 ...
12
votes
3answers
5k views

Is there a way to determine if SQL Server queries are running in memory or going to disk?

I came across a set of stored procedures in an application today that are called repeatedly within a long running process. Within each procedure I found multiple different select statements, some ...
2
votes
2answers
176 views

One database per company for “security” reasons [duplicate]

Possible Duplicate: Is that a good idea to use one database for 50.000+ shops? We are developing an internet application in C# with MVC 4. It's connected to a database which will contain a ...
2
votes
2answers
3k views

SQL Server replication subscriptions marked as inactive

Is there any way to force SQL Server NOT to mark subscriptions as inactive, ever? It happens sporadically when there are connection issues and I don't want to have to reinitialize the subscription ...
6
votes
1answer
779 views

Is it ALWAYS possible to avoid cursor?

I'm looking for any example where using a cursor is unavoidable. I'm pretty sure there are some rare cases like that, but I'm unable to come up with any scenario. Any help would be wonderful. Thanks!
1
vote
0answers
45 views

when can AG primary replica be a different host to WFC primary?

To set up an Availability Group with two servers, the servers both participate in a Windows Failover Cluster. I've seen cases after certain failover modes where the primary IP address in the cluster ...
-1
votes
1answer
388 views

Is it possible to create a trigger on a table synonym in SQL Server? [closed]

The title says (asks) it all. Is it possible to create a trigger on a table synonym in SQL Server (2005 or higher)?
2
votes
1answer
533 views

Disadvantages of reorganizing all tables nightly

I consider scheduling a SQL Server job that reorganizes all tables nightly. We don't have enterprise, so we cannot rebuild online (this means we need to reorganize). We also don't want to invest too ...
2
votes
1answer
1k views

Error: 9245, Severity: 16, State: 1. / During the last time interval XXX query notification errors were suppressed

I've got this sequence of error messages showing up regularly in my server error log: Error: 9245, Severity: 16, State: 1. During the last time interval 257 query notification errors were ...
3
votes
2answers
496 views

Can 2 tables lock each other if concurrent read/update do not affect same rows? pagelocks off

Can 2 tables cause a deadlock, if the pagelocks are off, and the rows are not related. E.g. Query 1 runs for a few seconds Select * from Orders where CustomerID = 1 and DateOrdered between @D1 and ...
6
votes
3answers
6k views

SQL update satement taking a very long time / high disk usage for hours

Yes it sounds like a very generic issue, but I have not been able to narrow it down very much yet. So I have an UPDATE statement in a sql batch file: UPDATE A SET A.X = B.X FROM A JOIN B ON A.B_ID = ...
6
votes
1answer
135 views

What is the effect of replacing indexes with filtered (non-null value) indexes?

Our project runs a very large, very complicated database. So about a month ago, we noticed that the space used by indexed columns containing null values was getting too large. As a response to that, I ...
1
vote
2answers
3k views

Getting SQL Server query history

I have used below query to get the history queries on ran SQL Server but it's not giving me the whole history it just returns queries ran on nearly about last 1/2 an hour. I want to get the queries ...
6
votes
4answers
1k views

Returning rows where all non-NULL values are equal

Is there a simpler T-SQL construct for "all of these columns to be equal (NULLs ignored) on a row" - effective I want to say: WHERE MIN(a, b, c) = MAX(a, b, c) OR COALESCE(a, b, c) IS NULL this ...
6
votes
1answer
1k views

Is “Estimated Number of Rows” always per execution within SSMS execution plans?

When I look at execution plans, I often compare "Estimated Number of Rows" with "Actual Number of Rows", looking for discrepancies. For example, when I hover over the bottom arrow in the picture ...
4
votes
2answers
12k views

Primary filegroup is full SQL Server 2008

I have a large table (~50 million rows) I'm trying to bulk insert into SQL Server and I get the error: Could not allocate space for object 'myDB' in database 'I 3 Stroke' because the 'PRIMARY' ...
2
votes
1answer
3k views

How to get a list of global temporary tables in the current database?

I am trying to get a list of the global temporary tables that are currently active. There seems to be an issue with them bumping in to each other (same name). As the 'acting' dba, trying to sort out a ...
3
votes
1answer
278 views

How to recover data around corrupted data in table? [closed]

I have a SQL Server database with some corrupted data unrepairable via DBCC CHECKDB in a table. I can get many of the rows before the corruption out - but how do I get the rows after the corruption ...
7
votes
5answers
16k views

How to query last restore date in SQL Server?

Is there a TSQL query that shows the last restore datetime for a certain database?
1
vote
2answers
348 views

How to link each column in sql?

I have been working around on a query given by one of my developers who works on crystal reports as a junior DBA, I always like to help them even though I am busy with other things as it will increase ...
5
votes
2answers
115 views

Relationship that are optionally more specific

Forgive my title, I couldn't think of anything that accurately describes what I'm talking about. I currently have the following relationship. CREATE TABLE Events ( ID INT IDENTITY(1,1) NOT ...
3
votes
1answer
455 views

Need help with long running query

UPDATE: Adding a clustered index to each work table covering all fields reduced the query run times to su-bsecond. I consider this question closed. Thanks for taking the time to read this post - ...
5
votes
1answer
410 views

Why did my transaction log grow so much? [duplicate]

Possible Duplicate: Why Does the Transaction Log Keep Growing or Run Out of Space? About a month ago I migrated my SQL Server 2008 R2 database to a new schema. I ran scripts to migrate the ...
0
votes
1answer
6k views

To drop a table, do I have to drop all foreign key constraints or can I just NOCHECK them?

I know you cannot drop a table that has active foreign key constraints. So I was wondering is it safe to: ALTER TABLE myTable NOCHECK CONSTRAINT all DROP TABLE myTable Rather than dropping the ...
2
votes
2answers
110 views

Index included columns

After running a fairly hefty query, the execution plan gave me a missing index suggestion which was of the form: (Timestamp) INCLUDE (CustomerID, EventID, ID, EmployeeID) Which seems to be a ...
1
vote
2answers
1k views

Conditional WHERE clause

I have, from what I can tell, a unique question. I would like to know if there's a way to construct a query in which the existence of the actual where clause itself is conditional. I'm writing a ...
1
vote
1answer
949 views

Missing 'Microsoft Office 12.0 Access Database Engine' in SSMS

I've got several users that need to import / export ACCDB Access files into out of SQL Server. Unfortunately, I have been unable to get 'Microsoft Office 12.0 Access Database Engine' to show up as a ...