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
0answers
6 views

SQLCMD.exe in SQL Server 2012 does not give real-time output logging

I'm running a long-running stored procedure using sqlcmd.exe for automation purposes. However, I observed that in SQL Server 2012, sqlcmd.exe does not produce real-time logging. It displays only when ...
0
votes
2answers
68 views

Trying to return empty rows even if data does not exsist in SQL

I am trying to return the last changed time for a list of users, but i would like to return a row even if the a last changed time does not exist select user_id, last_changed_time = ...
0
votes
1answer
17 views

Replicating tables from LAN database to web server?

I have an in-house database (that's actually part of a third-party product) running on 2008R2 Express. We'd like to display some of the data on a new website we're working on (running 2008R2). I'm ...
-1
votes
1answer
59 views

How to aggregate related rows

I want to group these related rows into trips (where each trip consists of a sequence from point 1->2->3->2->1). route Date time ------------------------------- point1 15/10/2014 ...
2
votes
3answers
100 views

What is the most effective way to discover all running instances of SQL Server using PowerShell?

I've been tasked with discovering all the instances of SQL Server that are running within our domain. In several cases there are multiple instances per server. I've seen two different PowerShell ...
2
votes
2answers
40 views

SQL Insert Statement Persists Two Records When I Need Just One

I have altered it to include hardcoded variables when I pulled this chunk of code from the stored procedure. I ran it independent of the application with the same result. I need one insert statement ...
0
votes
1answer
19 views

SQL Insert Statement Persists Two Records When I Need Just One [duplicate]

I have altered it to include hardcoded variables when I pulled this chunk of code from the stored procedure. I ran it independent of the application with the same result. I need one insert statement ...
2
votes
0answers
83 views

SQL Server mirroring causing issues

So we have a couple of SQL Server instances involved on mirroring without witness and operating mode is asynchronous in all cases. After we set put mirroring in place, we started facing connections ...
2
votes
2answers
216 views

How to use local variable in USE statement

How to use local variable in USE statement? I get error: Msg 911, Level 16, State 1, Line 6 Database 'DWSource_@Country' does not exist. Make sure that the name is entered correctly. Code: ...
1
vote
1answer
66 views

sql server service broker

For the last few days the service broker command which run from master database is consuming much more RESOURCES than before. The Impact on the Database is high (from the bad side), It causes for ...
-3
votes
0answers
34 views

Design a queue and table in SQL Server as per below data [closed]

Design a queue that holds messages (varchar(100)) for any number of users. Each message also has a priority of 1, 2, or 3, with one being highest priority. When a user gets a message (DEQUEUE), they ...
1
vote
1answer
45 views

TempDB not selectable for DBCC maintenance plan

I'm trying to clean up some of our maintenance plans and noticed that our TempDB is not getting it's weekly dose of DBCC CHECKDB goodness. I've tried to go into the maintenance plan and make sure ...
2
votes
3answers
219 views

Run multiple stored procedures in sequence

I have a stored procedure written in T-SQL (SQL Server 2008 R2). It is a master procedure that essentially call multiple other subprocedures in sequence. The call and error handling is identical for ...
1
vote
3answers
95 views

Tracking Down Application Timeout Errors in SQL Server

SQL Server 2008 SP3 How do I track down these timeout errors ? The errors are displayed on an intranet dashboard used specifically for error reporting in IIS. My suspicion is that there is a ...
0
votes
0answers
22 views

Sql server 2012 log file growth of cdc enbled db

All, I have cdc enabled on a Sql Server 2012 database that is a primary db in transactional replication and the primary in a availability group. The log file is a little over 95 GB, a historic high. I ...
1
vote
3answers
72 views

Deploying SQL Server database changes from test to production server

I have a high availability production server that runs SQL Server. It is constantly being read/write to by hundreds of users. I have an exact copy of the database on a testing server and do all the ...
1
vote
1answer
65 views

Unable to restore database

I am trying to restore several databases and I have no clue why some of them fail with the following error: Msg 3634, Level 16, State 1, Line 1 The operating system returned the error '1244(The ...
1
vote
2answers
52 views

Indexed views on double linked server

A server SERVER_A has some data. A server SERVER_B defines A as a linked server, and defines some views on the data. The queries are like this: CREATE view myview as select * from openquery ( ...
0
votes
4answers
64 views

SQL Server combine Update and Delete

Is it possible to combine both update and delete in a single SQL statement? I would like to execute something like this: update a set a.value = a.value + b.value from Table1 a join Table2 b on a.ID = ...
1
vote
2answers
34 views

MS SQL Server 2012 Log Shipping Questions

I have a few questions regarding Log Shipping in SQL Server 2012. 1) If the primary database server dies, is it possible to allow users to connect to the secondary database so as to continue working ...
3
votes
2answers
100 views

Insert only deadlocks

We have an application inserting data into a table. Unfortunately, we are getting deadlocks and the deadlocks are coming from inserts only. We are seeing the inserts take key locks in a different ...
0
votes
0answers
39 views

Problem in Incorporating filters into Data Warehouse design

While implementing a data warehouse (proof of concept) I have a requirement to incorporate a user level save-able filter on dimensions. The requirement is a proof of concept so I have the liberty to ...
0
votes
0answers
33 views

How to Synchronize the centralized SQL Server database with a local desktop SQL Server database, mobile device database(SQLITE) in bidirectional way? [closed]

There are number of devices i.e mobile, tablets and computer, laptops with same application. and one centralize database on the cloud. But local and devices database have the data with identity ...
1
vote
1answer
54 views

“Could not insert a backup or restore history/detail record in the msdb database” While restoring msdb

Today I found msdb database was in suspected mode, so I restored MSDB from my latest backup(As I have daily backup for this database). When I restore the MSDB database using Tsql i got below errors, ...
3
votes
2answers
507 views

Which of the following pieces of SQL is most efficient

I need to add the date part of GetDate() to the time part of a stored DateTime. Naively I thought I could do the following: declare @testTime DateTime = '2013-04-23 13:55:06' select cast(getdate() ...
0
votes
2answers
51 views

Live Partial Table / column replication

I want to know if there is a way to achieve the following with SQL Server 2012 Enterprise Edition? I have Table A: on Server 1 with say 10 columns. Table A: | col1 | col2 | col3 | coln | col10 | ...
5
votes
2answers
71 views

Is the runtime of checking for duplicate primary keys in SQL Server O(n)?

I was curious and I couldn't find too much info on this. Is it also O(n) for checking for duplicates among primary keys? Is it the same for most other SQL databases? Is there a place that lists this ...
5
votes
1answer
80 views

SQL Server stuck in single_user with auto_update_statistics_async on [on hold]

Books online states Before you set the database to SINGLE_USER, verify the AUTO_UPDATE_STATISTICS_ASYNC option is set to OFF. When set to ON, the background thread used to update statistics ...
0
votes
2answers
39 views

Find field that was changed

I have database with log backup every 15 minutes. I believe some data in one table was changed 10 hours ago. Is there any way I can find that query and located changed/updated data in log backup ...
0
votes
0answers
63 views

Problem with EXEC MyLinkedServer…sp_executesql within transaction

I rather clueless about this so any help is appreciated. We have got a stored procedure that is running within a transaction. The stored procedure is called from a .NET program (via normal ADO.NET). ...
0
votes
1answer
50 views

Working out Duplicated Data in a Customer Data Base

I have a database in SQL2008 of customers, There is an ID number for the customer. What im trying to do is to create a NEWID field. We have duplicated customers that have different ID fields, I am ...
0
votes
0answers
60 views

Window function sorting performance

For background, I am on an instance of SQL Server 2012 Enterprise Edition. I have three tables that join on the same set of three keys - all of them are INT. All tables have their keys clustered in ...
1
vote
1answer
126 views

What's the term that describes filtering query that makes use of indexes

I am looking for a technical term that describes the type of query in SQL that makes use of indexes. I completely forgot the name and can not look it up anymore (there's even a Wikipedia article about ...
0
votes
1answer
35 views

Automatic change of “initial size” of a database?

I just had a problem : days ago, on one of my client's databases, the LDF file suddenly grew up to 100% of the disk capacity. .TRN backups are correctly done every 15min (I don't think reducing this ...
2
votes
1answer
40 views

Restore database with different filename

I have to restore a new back up file daily (as an agent job, after first deleting the existing db) but the file name will vary as it will include the timestamp as well. How can I achieve this so ...
2
votes
3answers
80 views

How do I kill a rollback process when I want to drop the database?

I want to drop a SQL Server 2008 database, but it is currently performing a rollback for a transaction (that transaction took 3 days to run so far). How do I stop the rollback because I want to drop ...
0
votes
1answer
70 views

Best approach to have a Live copy of a table in the same database

I have a table where 15,000 to 20,000 rows are being inserted every hour. Table Schema is something like ColumnName DataType ID BIGINT IDENTITY(1,1) Column1 INT Column2 INT ...
5
votes
2answers
265 views

Terrible Bad Query Plan

I have a weird query plan problem. I have two databases (Let's call them DB1 and DB2) where both are sitting in the same SQL-Server instance and have identical schema. In there, we have a couple ...
0
votes
1answer
62 views

Select children from hierarchy (/a/b/c/d/)

I have to select from database which I did not create and I have this problem: example schema: Unit ---- id HierarchyPath (example: '/42/48/63/84/') UnitName (example1: "John" example2: "Team1") ...
1
vote
1answer
33 views

Minimum SQL Server rights that allow viewing column default values

I have an SQL Server 2008 database, some of the fields (columns) in some of the tables are configured with default values. I have a requirement to limit user security as much as possible, ideally ...
3
votes
1answer
47 views

How to join by most recent preceding date?

Imagine I have a database with historic price data and a second table with dates Item | Price | Date Customer | Item | date ------------------------- --------------------------- ...
1
vote
3answers
65 views

How to run sql agent jobs in a sequence order.with T-sql

My requirement is to run the SQL Agent jobs (EX: job1 to job10) with T-sql in a sequence order. That means job2 starts automatically when job1 completes. This process should continue until job10 ...
1
vote
0answers
43 views

The replication Merge Agent failed to propagate a Publisher schema change to the Subscriber

We are running 2 Microsoft SQL Servers - publisher (2008R2) / subscriber (2008 Express) with merge replication. I tried to make some schema changes via Transact-SQL and partly failed. So tried to ...
0
votes
1answer
36 views

Pulling all data modified in a month [duplicate]

i am required to WRITE A SCRIPT that pulls all the data that has been modified in last 30 days from a database. What approach do we need to follow.
1
vote
1answer
71 views

Stored Procedure slower on one server than the other

I have a stored procedure that I've been testing on two different servers and it runs slower on the server with more memory and I can't figure out why. Setup 1 is my virtual environment, ...
0
votes
0answers
41 views

What is the bare minimum access needed in the public role?

I need to lock down access to a specific database for a user - they should only have access to execute a couple of stored procedures. However, by default the user gets everything in the "public" ...
0
votes
1answer
27 views

Querying multiple servers via CMS: When does [Server Name] become 'real'?

Maybe a silly question. I set up an CMS earlier this year, which has improved my work day immeasurably. Servers are split into appropriate groups, but occasionally I only need to target some servers ...
0
votes
1answer
40 views

Can not re-set [log_reuse_wait] after log back up

I have a SQL Server 2005 database in full recovery mode with the following stats: name XX state 0 state_desc ONLINE size 2620152 max_size -1 growth 128 Log File name XX_Log state 0 ...
2
votes
2answers
48 views

Scrubbing sensitive data

I am looking for an automated solution to scrub sensitive data from my prod environment to my DEV and DEVINT environments so that I don't have to write lots of code to get this done. Does anyone know ...
4
votes
2answers
411 views

Restored Database is different from the original

I have recently performed a restore of our data-warehouse staging database onto a separate instance in our dev environment. After the restore I did a comparison and it looks like the database sizes ...