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
2k views

Grant select to dbo view without select on non dbo tables

SQL Server 2008 R2 We have a login & user called "JoeBlogs", this user has it's own default schema of JoeBlogs - it has Public access only to the database. We then granted it SELECT on a dbo ...
0
votes
1answer
1k views

How do I connect to a database which is a linked server via ODBC?

(All the searches for this sort of thing tell me about where the linked server is connecting to the original database via ODBC, but I'm connecting to the intermediate server via ODBC.) I have a ...
0
votes
2answers
161 views

SQL Server transaction log [duplicate]

Possible Duplicate: Why Does the Transaction Log Keep Growing or Run Out of Space? Is it possible to have SQL Server 2008 R2 reset the transaction log for certain databases when the ...
0
votes
2answers
811 views

Can you set up a SQL server maintenance plan to restore a database?

I am looking to setup a maintenance plan that makes a backup of a database (Database1) and then restores to another database (Database2) to confirm that it is able to restore successfully. Can I do ...
1
vote
1answer
91 views

Software/Hardware Upgrade

I've been working on a software/hardware upgrade from SQL2005 on win 2003 to SQL2008 R2 SP2 on win2008. The new hardware has 48 cores with 128 gig of ram whereas the older server 16 cores with 32Gig ...
1
vote
0answers
109 views

What permissions are required to view the contents of a catalog on a remote server?

I defined a linked server from a SQL Server box to a MySQL box. I went through a very detailed set of instructions and steps, everything works like a charm when I am logged in. The linked server ...
1
vote
2answers
703 views

Consistency errors for a SharePoint database

When I check my database (SQL Server 2008 R2, Windows Server 2008 R2, SharePoint 2007 DB) with the command: DBCC CheckDB I get 12 consistency errors (see below). Is the only way to fix it with ...
1
vote
3answers
2k views

Putting SQL Server data files in a different partition

I have a SQL Server and I put the data files (the .mdf) on a different partition. Windows runs from C: and the data files and logs are on D: Is it advantageous or disadvantageous to separate the ...
12
votes
1answer
1k views

Where are Statistics physically stored in SQL Server?

Where are the Statistics used by the Query Optimizer physically stored inside a SQL Server database file and the Buffer Pool? More specifically, is there a way to figure out the pages used by ...
1
vote
1answer
34 views

sql server session revert

Sql server log file stores the every log in information.is it possible to revert the query operation which we doing through query editor or by application based on the session we are logged in? ...
5
votes
2answers
1k views

Optimisation of complex query - 100% cost index seek?

I'm a c# developer, however I'm quite experienced with SQL. I have had a bit of experience with optimising queries but I've come up across one that has me stumped. The query takes about 3 minutes to ...
0
votes
1answer
2k views

How many IP numbers are there for a SQL server active active cluster setup also a active passive setup?

How many IP numbers are required for a SQL server active/ active cluster setup also what in the case of an active/ passive setup? Correct me if I am wrong 2 for private network 2 for public network ...
1
vote
2answers
220 views

correct security and user setup for SQL Server database

I am currently on setting a sql server database on a database server. A front end web application running off a web server communicates to the database. What is the best approach for setting up users ...
3
votes
2answers
563 views

Alternate ways to increase column size

I have a database that is in production, and in some instances will have millions of records. It has been requested that we increase the sizes of several columns, which is for the most part pretty ...
1
vote
1answer
4k views

Table schema column data type equivalents for Netezza 6 to SQL Server 2008

I'm trying to find a data type equivalents for data types in Netezza when migrating table schema to SQL Server. Where can I find a complete list? When getting down to brass tacks, I am specifically ...
2
votes
0answers
39 views

List of changes required to upgrade scripts after starting to use replication in SQL Server

We have recently setup transactional replication on our test and production databases. As part of that change, we've had to make changes to how we create upgrade scripts as well. The goal is to make ...
9
votes
3answers
405 views

Are these two queries logically equivalent?

Are these two queries logically equivalent? DECLARE @DateTime DATETIME = GETDATE() Query 1 SELECT * FROM MyTable WHERE Datediff(DAY, LogInsertTime, @DateTime) > 7 Query 2 SELECT * FROM ...
2
votes
1answer
162 views

How can I modify a trigger at subscribers SQL Server 2005?

I have a SQL Server 2005 publisher with SQL Server 2005 subscribers and one SQL Server 2000 subscriber running merge replication. Is there any way to modify triggers at a subscriber with the ...
2
votes
2answers
209 views

T-SQL Naming Standard

Is there a recommended (official or not) style from Microsoft regarding naming and casing in T-SQL? If there isn't one from Microsoft then is there one with broad acceptance?
1
vote
1answer
823 views

Cannot change the Delete Rule of a self referencing foreign-key-relationship to cascade delete

I have the following table [dbo].[myObj] ( [ID] [int] IDENTITY(1,1) NOT NULL, [fk_ParentID] [int] NULL ) and I have a relationship from fk_ParentID to ID. I want to change the Delete Rule ...
2
votes
2answers
64 views

How can I get a copy of the SQL generated by Management Studio?

If I save a table in Management Studio's Table Designer for example, I believe it runs DDL SQL in the background. Is it possible for me to grab this SQL so that I can save it to a file?
0
votes
1answer
517 views

TSQL query for viewing start/end of all SQL Agent jobs yesterday

See this related query: What's a good tool for visualizing SQL Agent jobs? I'm not after a visual tool however, since I am looking to build my own visualisation. This is my starting point, but ...
1
vote
3answers
1k views

Encrypt/Decrypt output & input for SSIS task

I use SSIS packages to output the data from one system as Comma Separated Values, and then import that same data into a second system. I have a new requirement to encrypt the CSV text files that are ...
1
vote
1answer
509 views

bulk insert from file

I am often requested to upload data from file (let's say csv) into a Sql Server 2008 db. I would like to use BULK INSERT, but I have no access to the db server file system. Questions is there a ...
1
vote
2answers
216 views

SQL Server Monitoring Tools [closed]

Can anyone recommend a good SQL server Monitoring Tool? One which will provide info on, server space usage, CPU usage , expensive queries run etc.
4
votes
1answer
364 views

Preventing users who are dbo from dropping their own databases

We allow our users to be dbo in their own databases, however this does give them the ability to drop their own databases. This doesn't happen very often, but I want to prevent them from doing this. ...
1
vote
1answer
545 views

Logshipping alert emails are being sent out while there is no error

I have logshipping setup with a Primary and a Secondary, and this has been working fine for a long time. Yesterday I started reveiving these emails: The log shipping primary database ...
3
votes
1answer
115 views

Strange SQL Statement Behavior

I have a simple SQL statement (executing on a SQL Server upgraded from 2000 to 2008 R2): SELECT TOP (1) DocNox = CONVERT(integer, SUBSTRING(DocNo, 2, LEN(DocNo)-1) FROM Tbl1 WHERE Fld1 = 19 ...
1
vote
0answers
159 views

Multi-Table Join to Single Destination

I am having a serious performance issue with join together four tables and placing the results (in a certain permutation) into one destination table. I am using MSSQL 2008 and good ole T-SQL. To ...
4
votes
1answer
99 views

How can I copy specific tables into one SQL Server Table into a separate table automatically?

I'm not sure if this is possible. Looking for some help with a specific issue. I am building an iPhone application with a data layer written in Ruby that will connect to SQL Server 2008. For various ...
2
votes
2answers
946 views

SQL Server 2012 CPU core usage

Having some trouble figuring out how to alter the core usage on SQL Server 2012 Enterprise. On a server with 16 cores, is there any way to alter which ones will actively use the SQL database, and not ...
2
votes
1answer
786 views

In Change Data Capture (CDC), how to configure retention with success?

We have CDC enabled on SQL Server 2008 with retention re-configured to a number other than the default 3 days (or something similar). When we first configured it (with default options), it worked ...
7
votes
1answer
904 views

What factors go into an Indexed View's Clustered Index being selected?

Breifly What factors go into they query optimizer's selection of an indexed view's index? For me, indexed views seem to defy what I understand about how the Optimizer picks indexes. I've seen this ...
0
votes
2answers
186 views

Regarding create index and lock word in SQL statement used for SQL Server

This way someone creates an index. CREATE TABLE [dbo].[QueueSlow]( [QueueID] [int] IDENTITY(1,1) NOT NULL, [QueueDateTime] [datetime] NOT NULL, [Title] [nvarchar](255) NOT NULL, [Status] [int] NOT ...
5
votes
3answers
222 views

How do I find I.O. statistics (by index) for queries in progress

By running SET STATISTICS IO ON before running a SQL query, I can get an idea of the number of logical reads performed on each index after the query completes. By looking at the view ...
2
votes
2answers
623 views

Creating CDC system table on SQL Server 2008

I am facing problem with CDC tables in my database. I think few of these tables are damaged and are not capturing any audit information. I tried to disable CDC on these tables, but that did not work ...
2
votes
2answers
538 views

What is the Maximum Merge Articles in Merge Replication [duplicate]

Possible Duplicate: Hard limitation for merge replication article count? I am using merge replication in SQL 2012. I am looking here: Maximum Capacity Specifications for SQL Server (2012) ...
2
votes
3answers
230 views

Transaction Log file .ldf is too small

Current database is almost 200GB however the transaction log file is only 4.1GB. I am worried if this influences the performance of databse and how could it be solved. When I do this query DECLARE ...
7
votes
1answer
1k views

What's a good SQL Server backup schedule?

There seems to be a plethora of information regarding the process of setting up backup tasks, but not much information about the big-picture view of database backups. At least, it's hard to formulate ...
5
votes
2answers
539 views

How to determine which SQL Server user or database overuses server resources

I have a Microsoft SQL Server instance on my server with more than 100 databases and users. Sometimes, the SQL Server process use 100% of server CPU and I want to know which query/user/database is ...
4
votes
1answer
61 views

Restricting mail sending from SQL Server 2008

On a remote database server, hosting databases from a number of different clients, how do I ensure that someone does not send emails using my profile?
0
votes
1answer
624 views

Getting “Cannot open user default database. Login failed.” for connections that don't specify a default database

I have two virtual machines. Server A is running SQL Server 2000. Server B is running SQL Server 2008R2. I am using the same domain user to log in to both boxes. But I cannot log in to SQL Server ...
2
votes
1answer
819 views

How can I cancel index creation in SQL Server

How can I cancel an index creation? It is still running and will run for a long time, because by accident I have created a clustered index; and non clustered indices are recreating on a really huge ...
3
votes
1answer
1k views

How can I create a dblink from Postgresql 8.3 to SQL Server (2000 and 2008)?

I have a Postgresql database that need to read data from two SQL Servers (one SQL Server 2000 and one SQL Server 2008). I want to setup two dblinks to the SQL Servers. After googling, foruming, ...
0
votes
1answer
69 views

Backup audit database

We currently have SQL Server 2000 in use. One is LIVE and one is BACKUP. We have an audit database which grows massively. What would be ideal is that at the end of each month, the data gets copied ...
1
vote
1answer
103 views

SQL Server Schema Security

I have a user U in a database where I want it to be able to create types and stored procs in a specified schema say UserSchema but not be able to alter schema dbo. So I created the schema and also ...
0
votes
2answers
124 views

Print variable of same datatype

I am looking for to print two variables of same datatype I have something like this declare @one int ,@two int set @one=1 set @two=2 print @one+@two obviously it will give a result 3 but I need ...
2
votes
2answers
765 views

SQL Server 2008 R2: Restore latest backup to new database from script

We have a database for each major version of our system, for each customer, for both development and test. Like so: WHATEVER44_CUSTOMERA_DEV WHATEVER44_CUSTOMERA_TEST WHATEVER44_CUSTOMERB_DEV ...
3
votes
2answers
8k views

SQL query to return a column per date in date range?

Let me explain what I've got and what I'm trying to achieve. Let's say I have Table A: BookingsPerPerson Person_Id ArrivalDate DepartureDate 123456 2012-01-01 2012-01-04 213415 ...
4
votes
2answers
414 views

Enumerate drives available to SQL Server

I'm trying to work out a way of listing the drives that a particular instance of SQL Server is "aware" of, and understand the process. I can run EXEC master..xp_fixeddrives which gives me a list of ...