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)

-1
votes
0answers
67 views

TempDb Growing Big on Staging SQL Server 2005 [duplicate]

I have a concern regarding Tempdb growth on one of my staging servers. Current size of Tempdb has grown to nearly 42 GB in size. Per standards we have split the data file into a primary .mdf and 7 ...
0
votes
0answers
39 views

Struggling with normalisation (database design critique)

I'm relatively new to database design and have been reading up a lot on best practice, and I'm starting to design a schema for a new application that will be developed and I am struggling with a few ...
0
votes
1answer
25 views

Distributed transaction coordinator between SQL Server and Oracle

I'm not sure about distributed transaction coordinator so please bare with me on this, I'm probably asking this question wrong. I know distributed transaction coordinator is used in SQL Server and can ...
1
vote
3answers
96 views

How to separate Stored Procedures (i.e. all the business logic) from Client Database so that it only contains client data?

Scenario: Our Application Database (in SQL Server 2012) contains entire business logic in the Stored Procedures (SPs). Everytime we have to publish the DB to the client, it unnecessarily results in ...
3
votes
1answer
97 views

Execute T-SQL Only If AlwaysOn Database Is Primary

Little background on the system. It is SQL Server 2012 AlwaysOn Availability Group with 1 primary and 1 secondary. I have been following this article (SSIS with AlwaysOn) to make SSIS work with ...
3
votes
3answers
213 views

SQL Server: Log Shipping in “restoring” state: Can I temporarily take it out of restoring to check it?

I know it is normal for the target db to be in "restoring" state I also would like to do a few queries as a sanity check that the data is all up to date. Can I take it to a read only, non-restoring ...
3
votes
0answers
61 views

CROSS APPLY giving 'incorrect syntax' error on one SQL Server 2008 R2 database, with compat level = 100?

I'm copying a stored procedure from a test database to a production one. Both are on SQL 2008 R2 servers, but test has SP 2 installed and prod is still RTM. The same CREATE PROCEDURE code will run ...
2
votes
1answer
105 views

Restore All Databases Script

I am migrating SQL Server DBs to a new instance. I have been told that it is possible to dynamically build a RESTORE script from available backups in the system catalog. Does anyone know of a sample ...
2
votes
3answers
149 views

Removing a string prefix

I have a string of numbers that I need to trim a portion from using TSQL. The string of numbers will always start with 101 then it will have a set of 0s and a set of random numbers. Example: ...
1
vote
1answer
78 views

Query Plan Different When Using Compiled Values

I have pulled out an execution plan from the plan cache and from the XML pulled out the compiled values. Then I have run the query in SSMS using the compiled values and the query plans are different ...
0
votes
2answers
62 views

How to count all relationships in a database?

I am developing a web application, which stores data in a Microsoft SQL Server database. My project manager has to deliver a report to non-tecnhical higher-ups, and thinks that it will read impressive ...
2
votes
1answer
72 views

Does READ UNCOMMITTED have the same effect as AUTOCOMMIT=1?

AFAIK running transactions as READ UNCOMMITTED means that there is no lock, so every change caused by a transaction is immediately visible to other transactions. Is it correct to assume that this is ...
3
votes
1answer
45 views

In which server does the snapshot agent run?

While configuring a publisher for replication, we execute sp_startpublication_snapshot SP and provide the publication name as a parameter to the SP. We do not specify the distribution server's ...
1
vote
2answers
62 views

Create failed for Index 'ClusteredColumnStoreIndex'. Timeout expired

I am creating Clustered Column Store Index in SQL Server 2014. I am getting error as "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not ...
1
vote
1answer
49 views

SQL Blocking, SPID of -2

We have some blocking going on in our database and when I run sp_who2, in the BlkBy field, I see "-2" for two of the rows. What does this mean? Running SQL Server 2008 R2
0
votes
2answers
28 views

Build replication from backup not publication source

I have an interesting scenario I am trying to find a solution to. We currently have the current setup. ProductionDatabase (publisher) is the publication for transnational replication to the ...
3
votes
1answer
204 views

Formal name for functions that use the OVER clause

Is there a formal/academic name for the family of functions in Sql Server like ROW_NUMBER(), LAG, LEAD, RANK etc, that make use of the OVER(ORDER BY <PARTITION BY> ) syntax? How much of this is ...
0
votes
1answer
33 views

Show Non-NULL values from 2 columns in a single column

I need to take the non-null values from two columns and show in a new column: ‘D_Country’. C_Country(Customer) P_Country(Prospect) Each of these columns may have NULL values depending on who the ...
3
votes
2answers
63 views

Reindexing Clustered Primary Key

We need to reindex a Clustered Primary Key on quite a large table. Here is the definition of the table: Data Size: 22GB Index Size: 34GB Total Non-Clustered Indexes: 3 Row Count: 54 Million Data ...
1
vote
1answer
55 views

Why do sys.columns and INFORMATION_SCHEMA.COLUMNS display different number of columns [closed]

Here i am try. Two method to display Particular column name in particular Database in sql server 2008 R2? Use INFORMATION_SCHEMA.COLUMNS SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE ...
0
votes
1answer
28 views

How can I restore ##MS_SSISServerCleanupJobLogin##?

At some point the SSIS cleanup job login (##MS_SSISServerCleanupJobLogin##) got deleted from my sql server (2012). I'm trying to upgrade to SP2 and I'm getting an error message I believe is related to ...
5
votes
2answers
334 views

Index seek much slower with OR condition compared with separate SELECTs

Based on these questions and the answers given: SQL 2008 Server - performance loss possibly connected with a very large table Large table with historical data allocates too much of SQL Server 2008 ...
5
votes
2answers
103 views

Adding a sequence number to existing rows

I have a table with an OrderSequence column. The schema looks roughly like this: id Name OrderSequence I have an array of ids ["1", "2", "3", "4"] from an application, and I want to set the ...
0
votes
1answer
27 views

Trigger on a Schema

Is it possible to create a Trigger on a Schema? I have to audit the changes on my tables. But I have a lot of tables and I don't one to create a trigger on them one by one. --Database level trigger. ...
1
vote
1answer
42 views

Will Transactional Replication Work?

I have multiple site servers and a central server. Each has a Widget table with identical schema. There is currently a custom process that sends new Widget records from the site server that ...
5
votes
2answers
105 views

SQL Server: Create New GUID Values for Existing Index

I have an existing table with about 6 million rows. The relevant columns are: ID int not null PK Key uniqueidentifier not null Read/write on this table by Key lookup is probably something like 100 ...
1
vote
1answer
76 views

Performing deltas / diffs over VPN from Oracle to SQL Server database

I have inherited a reporting structure that is quite the Rube Goldberg device. I have a collection of MS Access 2003 databases that I have begun to migrate to SQL Server. My current hangup is that we ...
3
votes
1answer
73 views

Difficulty getting sp_executesql to work

Alex Aza's comment solution here generates all names of tables with records referencing a specified input record. I would like to adapt Alex's solution into a table-valued function. I'm having trouble ...
0
votes
0answers
54 views

SQL Server, I can execute sqlcmd with trusted connection but not sqlpackage

We have some deployment scripts that use a combination of dacpacs through sqlpackage and straight scripts using sqlcmd. When I execute the sqlpackage dac\sqlpackage.exe ...
8
votes
1answer
906 views

What happens during “big” inserts on a table with a clustered composite key?

My SQL knowledge is limited, so the terms I'll be using are most likely not the right ones. I have a table that will store test results, for multiple locations. The tests will be recorded in ...
0
votes
1answer
66 views

Update primary key column - NULL issue

I want to update a column that is a primary key using this code use BITS_TEE Update DMT_TEE_DTS_Production set ABCIndicatorCode = ( select HIST.ABCIndicatorCode from ...
1
vote
1answer
60 views

Change rowguidcol property to a different column

In my SQL Server 2008 database, I have a table with two uniqueidentifier columns. CREATE TABLE MyTable ( Col1 uniqueidentifier rowguidcol not null, Col2 uniqueidentifier not null, ...
4
votes
1answer
81 views

Incorrect result when you execute a query that uses WITH RECOMPILE option in SQL Server 2012 [closed]

I just read the Brent Ozar Weekly Links email (July 28th Edition), and noticed the "Kendra's Link" talking about "Fix: Incorrect result when you execute a query that uses WITH RECOMPILE option in SQL ...
0
votes
1answer
49 views

Case always returns null?

I have a subquery that gets the DATEDIFF of two dates. However the first case always returns null yet the actual sub query returns dates?! CASE WHEN [date1] > [date2] THEN ...
1
vote
1answer
28 views

Spatial Index ignored when using additional non-spatial conditions

Why does SQL Server ignore my spatial index when I use additional conditions? If I add an INDEX hint it will use the correct index, and runs a lot faster. I would like to avoid using the hint if ...
1
vote
0answers
78 views

1 TB Database import, best options? [closed]

Friends, We have received 1 TB external hard drive with 750 GB MS SQL server zipped backup file in it from our client. We need to import this database at our end and then write programs to retrieve ...
0
votes
1answer
36 views

Select IDs according to CSV file

I have a CSV file with IDs of rows. I want to use that to make a SELECT statement selecting the IDs within that CSV file. There is 1 million rows and I want to select about 95,000 of those. I want ...
4
votes
2answers
64 views

Sql Server Management Studio login prompt will never forget other sql user than SA

When I login to a database, using some other user than SA, that username will stick the next time I login. If I then input the username SA and password and logs in, the next time I open the login ...
1
vote
2answers
80 views

Fixing an error 9004 without taking the database offline

My database (SQL Server 2008 r2) is running fine but I’m getting the following error in my event log. Error: 9004, Severity: 23, State: 6. An error occurred while processing the log for database ...
2
votes
2answers
62 views

Help reading deadlock XML

Even with reading the Bart Duncan blog about reading deadlocks I still struggle with this. I have included the XML from a particular deadlock. <?xml version="1.0" encoding="utf-8" ?> - ...
1
vote
4answers
153 views

Large table with historical data allocates too much of SQL Server 2008 Std. memory - performance loss for other databases

Based on this question and the answers given: SQL 2008 Server - performance loss possibly connected with a very large table I have discovered memory allocation problem with SQL Server 2008. ...
1
vote
2answers
32 views

Store n:m data with most n:1 tuples

I have these tables: create table data ( id int identity not null, ref int not null ); create table reference ( refid int not null ); with ~2 million rows in data and ~200k rows in ...
0
votes
2answers
33 views

Get the table affected by the query

How I can get the table which is affected by the query? Example Update cust Set name = 'john' Where custid = '4001' Output: cust ___________________________ Insert into emp(fname, lname) ...
-1
votes
2answers
60 views

SQL Server 2012 Browser Service doesn't appear [closed]

I've installed SQL Server 2012 and Management Studio Express. I attached the database that belongs my previous Project in Visual Studio. But I am having SqlException Error , I think the reason of the ...
1
vote
1answer
49 views

Cluster Size Configurations for SQL Server at RAID Level

I was reading the below two articles (one of which I posted) and one recommends to use a RAID cluster stripe size of 256k while the other recommends to use 64k. There is a big difference between the ...
0
votes
1answer
40 views

Migration query taking time

I'm doing a migration from Oracle to SQL Server and, for one of the tables where we have 3 million records, it is taking a lot of time to complete. When I check the activity monitor, I can see the a ...
0
votes
1answer
98 views

INSERT/SELECT slow after TRUNCATE TABLE on table with 6 over mllion rows

Seeing slowness in insert/select after truncating a table that has over 6 million rows. I daily insert 5 to 6 millions records into a table and I was able to insert/select data without any issue for ...
0
votes
1answer
60 views

Migrating SQL database to a new SQL server

Thanks for viewing my question. I currently have a database on SQL Server 2005, which is being migrated to SQL Server 2008. Each SQL Server is named differently in SSMS. The old is named GARDB1, and ...
3
votes
1answer
59 views

Does anyone have example for setting up a job to reduce SQL Server max memory and recycle SQL server service?

I have both SQL Server 2008 and SSAS running on the same machine (Don't ask me why, I have to live with it for now!). Since we run ETL and Cube generation in sequence, I wanted to allocate large ...
1
vote
3answers
89 views

How do I select 1st row of each table and insert that data to a new table

i have 5 tables (tab1, tab2, tab3, tab4 and tab5) and all the 5 tables has same table definition. I want to select 1st row of each table and insert those 5 rows in new table(newtab). I was only able ...