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)

2
votes
0answers
60 views

Why does Recursive CTE estimate just 1 row?

Given two cascading, self-contained (no real tables) recursive CTE's: create view NumberSequence_0_100_View as with NumberSequence as ( select 0 as Number union all select Number + 1 ...
0
votes
2answers
43 views

“WITH REPLACE” Restore failing with same logical filenames

Does using WITH REPLACE when the logical filenames match (to avoid using WITH MOVE) fail when the backup is from a different version of SQL? I have a backup from SQL 2008 but when I attempted to ...
0
votes
2answers
97 views

How to reduce the run time of stored procedure by getting rid of cursors?

I have a task of reducing the run time of a stored procedure that runs for hours. Description of task: The cursor takes a set of values @Master and @Slave obtained from a query(5000+ rows), finds ...
0
votes
0answers
32 views

Firewall rules to allow remote connection to SQL Server in a different domain [migrated]

I recently installed SQL Server Express 2014 on a series of machines running Windows Server 2012. Seven machines in total. All but 1 of them live in the same local domain company.local. A single ...
0
votes
1answer
43 views

How to deal with very large transaction logs in SQL Server

Here is my situation: I have being asked to deal with a SQL Server 2008 R2 database that has a transaction log that is several times bigger than the database itself. The database is in full recovery ...
2
votes
2answers
65 views

Should I check for existence of temp tables in Stored Procedures?

Is there any edge case in which it would be recommended to explicitly check for ,drop and create temp tables at the start of a Stored Procedure instead of just creating them? Similarly, is there a ...
0
votes
0answers
36 views

Subscription fails with Incorrect syntax near '9'

In my Distributor To Subscriber History I get the following error: Command attempted: 9 (Transaction sequence number: 0x0018E94F0000207A006200000000, Command ID: 59) Error messages: ...
0
votes
1answer
54 views

SQL Server 2000 Backup fails with Status = 33

I am trying to take a Full Backup of a database size about 75GB. It is SQL Server 2000 - 8.00.2055 x86 version. I have plenty of disk space where the backup is being created. So disk space isn't an ...
5
votes
1answer
62 views

Full Text Search Term Casing Affects Results

I have been experiencing a full text problem when searching using CONTAINS. I have the full text catalog accent sensitive setting set to false. The table contains following rows: Microsoft C# ...
-3
votes
3answers
71 views

SQL cache hit ratio [closed]

I have install SQL server, but when i check report of DB there is cache hit ratio which is 98.92%. Is it harmful for sql, if yes then how to reduce it.....? please give me solution for that. thanks, ...
3
votes
1answer
66 views

Microsoft SQL Server Connection Coloring

I've been using the Redgate Query Tab Coloring feature (under SQL Prompt's Experimental Features) and I really like it. Somehow I've never known until today that this feature is built in to SSMS for ...
0
votes
1answer
29 views

How to find when change tracking was enabled?

How can I determine when change tracking was enabled on a table in a SQL database? Assume that this table has a regular cleanup routine, which means that looking at the oldest record in the change ...
3
votes
2answers
69 views

Designating databases to certain CPUs

SQL Server 2012. AlwaysOn Cluster with two nodes, each has 4 cores We are consolidating SQL server instances and moving bunch of databases from various locations to a single cluster which has two ...
0
votes
1answer
30 views

Script to Add a Job to a SQL Server DB

I want to add a job to my DB to make a back up weekly but i want to do it from an script, i've serched and with what i found i made this: CREATE SCHEMA job go CREATE PROC BACKUPS @dir varchar(max) AS ...
1
vote
0answers
116 views

Transaction log full due to log_backup

I am testing how certain operations are logged under different recovery models.Below are steps i have did till now 1.create database in full recovery model 2.take backup 3.create a table and insert ...
2
votes
2answers
82 views

Filtered index not chosen, and rejected with hint

I'm trying to understand why a non-clustered index is not available for a given query when filtered. The relevant part of my (large) query is this: ) results JOIN BE_Insurance ins ON results.PayorId ...
1
vote
1answer
22 views

Enable Agent Database Mail - TSQL

I have several new servers that need Database Mail configured on them. I found the TechNet article describing how to add the profile and account via procedure calls, but is there a way to enable ...
0
votes
0answers
44 views

Migrating SQL Server 2008 R2 to SQL Server 2014. What are the importing replication changes?

We currently have SQL Server 2008 R2 on our server. I now have the opportunity to migrate to SQL Server 2014. The database we use isn't large. Migration of data is not a issue. The question I have ...
1
vote
1answer
57 views

SQL Server data structure (in protocol)

If I have a Book table and Author table, with Book having a foreign key to Author, many rows in Book may have the same author. If I then run this query: SELECT * FROM Book INNER JOIN Author ON ...
11
votes
1answer
236 views

Why aggregate operator used after unique index scan

I have a table with a unique index filtered for non-nullable values. In the query plan there is use of distinct. Is there a reason for this? USE tempdb CREATE TABLE T1( Id INT NOT NULL IDENTITY ...
0
votes
1answer
20 views

Don't delete exist data with SSMA

I'm trying to use Microsoft's SQL Server Migration Assistant for Sybase 5.3 ('SSMA') to migrate multiple Sybase databases (that have the same schema) to a single MSSQL database. The first database ...
0
votes
1answer
45 views

Does it make sense to order condition in where query?

We have a clustered index in table Tbl with order of A,B,C. Does it make senses to write a query to have WHERE A = @a, B = @b, C = @c or it'll be as same as WHERE C = @c, B = @b, A = @a Does the ...
0
votes
1answer
56 views

Database going to Suspect mode [closed]

I have a frequent problem, that is one of my databases goes to suspect mode. Many times I have recovered it with: ALTER DATABASE Your_Db SET EMERGENCY DBCC checkdb('Your_Db') ALTER DATABASE Your_Db ...
2
votes
1answer
38 views

Reporting services scheduled reports are clogging up sql job history log

This is a bit of a cross-disciplinary question - Hopefully I’ve posted in the right place. SQL server 2008 R2 Question: How can I limit the number of rows in [sysjobhistory] for specific jobs, ...
0
votes
0answers
53 views

Last few rows from a non-indexed table in Oracle

I'm trying to run a query on an Oracle DB through SQL Server [dont' ask, it's a requirement] The Oracle table in question [lets call it hugeTable] has over 200 million rows and no index. I'm not ...
0
votes
1answer
44 views

Is it possible to create a function in SQL server to act as clause e.g. Where or Limit

I've found a simple way to mimic the limit clause is SQL server by using SELECT * FROM customers OFFSET 22 ROWS FETCH NEXT 5 ROWS ONLY I'd like to replace those two line with LIMIT(22, 5) e.g. ...
0
votes
3answers
62 views

What is the quickest way to restore a DB

Lately I have been finding myself restoring a DB to my local instance of SQL-server a lot more. I wanted to speed up the process by writing a script and then just executing it in order to restore over ...
0
votes
2answers
48 views

Set default value for all columns with specific name within a database

I've got a database that includes an int column project_id on many tables, and I want to script setting the default value to a specific value for all columns with that name in the database. Note that ...
0
votes
1answer
30 views

Extra column when migrating Sybase databases to single SQL Server database

I'm trying to use Microsoft's SQL Server Migration Assistant for Sybase ('SSMA') to migrate multiple Sybase databases (that have the same schema) to a single SQL Server database. All of the tables in ...
0
votes
1answer
27 views

How to install/enable DAX functions in SQL Server [closed]

How to install/enable DAX functions in SQL Server? I want to pivot and use some Excel functions in SQL Server
0
votes
0answers
23 views

Setup for Availability Group with Analysis Services

We currently have one server with the Database Engine, SSAS, SSRS and SSIS all running on it. We are moving to a two server Availability Group setup. Currently I am not too worried about resources ...
2
votes
1answer
89 views

Database design for a table with both bulk insert and single row insert

I have to design a table where records will be inserted in two ways. Bulk insert from a batch process from a delimited text file between 2 - 3 million rows in a short burst. Later the same records ...
0
votes
1answer
39 views

Store logging in separate or existing database?

In a .NET WebForms project we want to log certain actions in a database for a year. The estimate is that the log will have a maximum size of 1GB (20.000 records per day of 10 fields) that will ...
1
vote
0answers
40 views

SQL Server : ALTER TABLE tablename SWITCH PARTITION 2 to tempempty

Have a sliding partition where I need to remove the trailing partition when they expire. I create an empty table that matches the existing table. When I create the empty table, I specify the file ...
0
votes
0answers
28 views

How to extend the Central Management Server in SSMS?

I'm looking into Central Management Server and I'm a bit surprised there's no 'Custom Reports' node in SSMS to add things into. It seems like that's exactly where you would want to place something ...
1
vote
0answers
54 views

Is it possible to use a temp table in a data flow source?

I have a data flow in a 2012 SSIS package where I'm trying to use a temp table as the data source. I'm using an OLE DB data source with a SQL Command Data access mode. My code looks like this: ...
2
votes
0answers
34 views

Slow Performance of Parametrized Query in Excel due to Parameter Datatype

I'm pulling Data from a SQL Server 2008 into Excel using a Parametrized ODBC Query created by the Excel Wizard. (Data-->getExternalData/FromOtherSources-->FromDataConnectionWizard-->ODBC DSN) My ...
2
votes
1answer
48 views

Temporarily splitting a SQL Server cluster

I currently have a pair of database servers up and running separately, but with the same structure and (hopefully) the same data on both of them. The applications that utilize the data from these ...
0
votes
0answers
53 views

SQL Server Agents Jobs failed when executed on schedule but succeeds when executed manually

I have a SQL job running an SSIS Package. This job can run manually but failed to run on schedule. The below is the error message generated. Any help will be highly appreciated. Code: 0x4004300A ...
0
votes
0answers
52 views

Index Tuning Question

I have the following query: SELECT T1.ITEMID, T1.ITEMTYPE, T1.PURCHMODEL, T1.HEIGHT, T1.WIDTH, T1.SALESMODEL, T1.COSTGROUPID, T1.REQGROUPID, T1.EPCMANAGER, ...
4
votes
2answers
132 views

How to write a query which finds all circular references when a table references itself? (II)

I have the following schema (names changed), which I cannot change: CREATE TABLE MyTable ( Id INT NOT NULL PRIMARY KEY, ParentId INT NOT NULL ); ALTER TABLE MyTable ADD FOREIGN KEY ...
0
votes
1answer
57 views

How to deploy SSIS package with XML config, using SQL agent

I wonder if anyone can help me with a question. Context I've created a database which needs a front end in MS Excel. When the user presses upload button I want it to start an SSIS package which moves ...
1
vote
2answers
71 views

Update on view over partitioned tables updating all indexes

We have a table, which is partitioned through a date field into separate years. There is a view over all of these tables (Call) Schema is as follows: CREATE TABLE [dbo].[Call_2015]( [calID] ...
2
votes
2answers
372 views

SQL Server : what licence is required? [closed]

I want to use SQL Server for a big project and was wanting to know what licence is needed, Enterprise or Standard? I have 2 servers and I'm looking to have the first as a primary and the second as a ...
1
vote
2answers
130 views

Converting a varchar date into a date (dd/mm/yy)

I have a CSV file that has dates written like this: 250909,240909 and they get stored in a SQL Server database as varchars. How do I get it to convert them into dates so that it gets displayed like ...
0
votes
0answers
12 views

Multiple Trace Files or Replay

I am just wondering how useful the replay functionality of SQL profiler is. The issue I have is that I can capture a workload from production with little overhead, however I would not be able to ...
0
votes
0answers
39 views

How to avoid copy of audit trace files

My database is copying all of SQL-Server trace data file everyday. The result is I have to delete them manually everyday because hard disk gets filled. How can I stop this?
0
votes
1answer
69 views

Create multiple variable columns from single column value

The following code gets the number of days for a specific month set in @month DECLARE @month tinyint , @Days varchar(max) SET @month = 1 -January ;WITH DaysInMonth AS ( SELECT DATEADD(month, ...
1
vote
1answer
55 views

Cannot open database “user_auth.mdf” requested by the login. The login failed. Login failed for user 'web_user'

I am trying to deploy my first VB.NET application on GODADDY. I created a SQL server database and was able to create tables using SQL Server Management Studio. I created a user web_user and was able ...
1
vote
2answers
58 views

Undo Deleted Records [duplicate]

My Database has Full BackUp Plan on Every Morning on 01:00 Am. Today I came to work and Deleted all of the Records in a table by mistake in sql server management Studio by running this command delete ...