All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

learn more… | top users | synonyms (2)

0
votes
0answers
37 views

Looking for additional ideas on transaction log waits

We are seeing high Log Waits on our SQL Servers. Our Production server can be in the hundreds of milliseconds. We are running SQL Server 2008 R2 on Win 2008 R2. The server is virtual using VMware. ...
-1
votes
0answers
25 views

Issues when try to open VS editor from Script task from BIDS

I am getting below issues from SQL Server Data Tools. I reinstalled Data Tools on the system a lot of times & repaired VS a lot of times. Even then I am not able to fix the issues. Can you ...
0
votes
0answers
29 views

concatenate/using string doesn't work while query for clearing table [closed]

My boss required me to write a query that clear tables... and i searched and found some code, put them together, at the end, for simplify and remove any mistake, put the code in variables... but it ...
3
votes
3answers
262 views

Long running delete query

I have a table with roughly 11 million rows, defined as: CREATE TABLE [sko].[stage_närvaro]( [datum_fakta] [datetime] NULL, [person_id] nvarchar NULL, [läsår_fakta] nvarchar NULL, ...
0
votes
1answer
34 views

Deselect CPU in affinity setting for OS Only use?

A memory recommendation is to reduce MaxMemory by 4GB or 10% of RAM (equally divisible by cores) to dedicate that memory for the OS. Most questions on CPU affinity deal with splitting them out ...
3
votes
2answers
73 views

“Sniff” SQL queries being sent out from my computer

I'm a student working on pulling certain information from an SQL server here at work. I don't have sysadmin privileges and my attempts at receiving them have not been met with success. It's a big ...
0
votes
1answer
44 views

Rebuild system databases to a different location

Firstly, forgive my poor question title. I couldn't think of the best way to summarise this. Essentially I'm putting together some scenario based DR documentation, with this specific scenario being ...
0
votes
0answers
46 views

Unrecoverable error occurred during Flush operation

We have been backing up our on premise SQL instances (3 different servers) to various azure storage accounts for the past several months without issue. Starting from July 14th, we have been ...
1
vote
0answers
17 views

Cannot connect to WMI provider, SQL Server Configuration manager

I cant connect to SQL Server Configuration manager. I have installed SQL Server 2014 x64 Standard edition and SQL Server Management Studio ,which I can open and work with. Just to point out, that I ...
1
vote
1answer
60 views

is there a term for databases which are not system databases? [closed]

Is there a term for all databases in SQL Server that are not system databases (such as master, model, tempdb)?
4
votes
3answers
96 views

Assign db_owner to all users at once

I need to assign db_owner to all users within an instance. There are a few hundred logins and same number of databases within the instance. I would like each user to get db_owner within the database ...
12
votes
2answers
248 views

How to track blocking that happen for less than a second - SQL Server

I am trying to troubleshoot a blocking issue which happens for less than a second. The OLTP application is very sensitive and has to have an response time of less than 200ms for some transactions as ...
0
votes
0answers
20 views

How to return columns when using Dynamic Sql

In my project, i want to search input values and i think i should create a SP using dynamic Sql. When i call this SP in MVC, it return "int".I want it return columns as ProductName,ProductCat ... . ...
1
vote
0answers
33 views

ms sql database in suspect mode when we upgrade from developer to standard edition [duplicate]

sql database in suspect mode when we upgrade from developer to standard edition 2012 version. in log file there is two error occurred 933 and error 905. following error occurred when we try to get ...
0
votes
1answer
45 views

Query to Find Out How Many Days Until Database Is Full

Using my central MDW database I am trying to make a query that will be able to calculate the number of days until all my databases free space will be full. Currently the query I have is overly ...
2
votes
3answers
207 views

Use of IMPERSONATE permissions in SQL Server?

During some reading, got to know about the Impersonate permissions. From what I've read, it is more like creating a copy of the user with all the permission levels under a different name. I understand ...
2
votes
1answer
382 views

Is there a way to get SQL Server capcity constraints dynamically

I have some code which creates database tables dynamically, and I want to ensure that people don't try to do things that result in me trying to create a table with more columns than what SQL Server ...
0
votes
0answers
18 views

Clustering SSAS

We are using both SQL Server 2012 and 2014 always on. Here is my issue: we have an application that I have set up to use Availability groups(2014), however the issue I am having is that it uses ...
1
vote
2answers
42 views

SQL Server Always On or Mirroring & Log Shipping

We have two data centers with a 2 ms ping time between them connected by a site to site VPN. In the primary data center we have 2 servers, in the secondary data center we have a single database server....
1
vote
2answers
143 views

PERCENT_RANK does not distribute over 100

I'm trying to find out the position of each given record of a query in 0-100 scale. I use PERCENT_RANK ranking function this way: select Term, Frequency, percent_rank() over (order by Frequency desc) ...
-1
votes
2answers
72 views

How to PIVOT/UNPIVOT if I don't know how many columns will it have?

I have this simple query: I want to list something like this: Unidade1 \ PLaca1 \ Placa2 \ Placa3 Unidade2 \ Placa1 \ Placa2 But I don't know how many placas a unidade will have. I was ...
3
votes
1answer
44 views

FastTrack Data Warehouse -E startup parameter

We are running a data warehouse based on the Fast Track architecture. One of the recommendations with Fast Track is to enable the -E parameter at SQL Server startup (increases the number of extents ...
0
votes
2answers
34 views

Passing a list to a SQL query in SSIS

I need to be able to pass a list of undefined size that will contain numbers like so ('1900'),('1920'),... to and OLE DB source in SSIS. as of right now I am trying a lot of different things that ...
0
votes
0answers
78 views

SQL query runs fast on local computers but slow on production server

I am running a fairly basic query on my local development machine which runs almost instantly. However on the server its taking around 3-4 seconds to return results. I have ran Client Statistics on ...
0
votes
2answers
35 views

Can I tell if a stored procedure has executed against a particular database?

As a result of a release a db is behaving "unusually". I suspect a stored procedure was missed during release, but my dba is telling me 100% it was executed. Is there any way to definitively prove ...
0
votes
1answer
27 views

Temporarily stop Log shipping [closed]

How can I temporarily stop log shipping --> Do the task --> Start the Log shipping ? Is it possible ?
0
votes
1answer
36 views

Shrinking Database

We have two databases in SQL Server 2005 with installed navision database in both database. Due to disk space I want to shrink old database which is not in use and having 40% free space in .mdf and 20%...
0
votes
0answers
22 views

Why does SQL Server Managed Backup create so many full backups?

I have a SQL Server 2014 database with Managed Backup configured to send regular backups to Azure storage. It's been happily churning out log backups for months now that provide full coverage for the ...
3
votes
2answers
55 views

Can an SQL Job Deletes itself after its end date?

I have created a job which will sets up its start date and end date automatically with a dynamic value. For example: Job will run for eight days and at eighth day it needs to automatically deletes ...
2
votes
2answers
34 views

Help with FOR XML EXPLICIT query

I have an audit table constructed (basically) as follows: CREATE TABLE [dbo].[AUDIT]( [UNIQUE_ID] [int] IDENTITY(1,1) NOT NULL, [TABLE_NAME] [nvarchar](50) NOT NULL, [TABLE_UNIQUE_ID] [int] NOT NULL, ...
0
votes
1answer
30 views

Creating multiple windows login on a single databae

I am able to create a window login on a database I created. This windows authentication login is based on a windows user that I created earlier, but I don't seem to know how to login into SQL server ...
0
votes
2answers
20 views

SQL server after RAID problems

We had a SQL server die due to some RAID problems. We sent the machine out to a data recovery company and they are able to recover the .MDF and .LDF files from the drives. Will I be able to use ...
0
votes
2answers
41 views

Migrate a SQL Server instance from one server to another [closed]

I have a database for my website running on AWS. My web admin has given me access to the database, and I'd like to host and manage it on my own. How do I migrate the SQL database from AWS to my own ...
1
vote
1answer
33 views

First and last records in a string of linked rows

I have been handed an (ancient) database in SQLServer format containing rental records. These records can be modified by the customer while the rental is still in flight, if they want the drill for ...
0
votes
1answer
25 views

Call to sysmail_delete_mailitems_sp keeps deadlocking

I run SQL Server 2012. I have a maintenance job that runs every night. At the end of the maintenance, I do some cleanup and call this: Begin try Exec msdb.dbo.sysmail_delete_log_sp @logged_before = '...
3
votes
1answer
63 views

SQL database in status SUSPECT

I had a database in status SUSPECT (No items). I have not Backup. I've only .mdf and .ldf files. After reading all answer regarding this topic, I executed all commands to fix this status, but without ...
0
votes
0answers
38 views

Issues with partitioning

Looking for scale out option for my SQL server database. I have a table that has 15 million rows and it adds 10,000 rows every day. From various options available to scale out I opted for partitioning,...
0
votes
2answers
34 views

Get attribute value of XML

I went through at least 5 question on SE, but I must be doing something very bad out of frustration already. I have a stored procedure that returns an XML like this: <pmsg:Messages> <...
1
vote
1answer
29 views

Can I use SNAPSHOT for large catalogs?

I've been reading about Snapshots, and it says you can send small catalogs lets say, in a monthly routine. I liked the Idea and i will start to study about this, but can I use snapshot for large ...
0
votes
0answers
42 views

Selecting a View consumes 4GB memory but executing SQL statement of View only 70 MB

I am facing high memory consumption on my database server. During diagnosis, I found a view consuming 4 GB memory. But when I executed it's statement (select statement of view) it's taking only 70 MB. ...
8
votes
2answers
107 views

Increase a counter for each changed row

I'm using SQL Server 2008 Standard, which doesn't have a SEQUENCE feature. An external system reads data from several dedicated tables of the main database. External system keeps a copy of data and ...
1
vote
2answers
66 views

Change database loaction

I have installed new MS SQL Web Edition on C Drive and I have also another D drive on server. Now I want to change database location, like when we make new database it should be make on D drive. Can ...
3
votes
1answer
43 views

Any disadvantage to automatically changing FULL backup on AlwaysON Secondary to COPY_ONLY?

I've been playing around with Ola's maintenance scripts recently, and they are absolutely great. However, I was considering one scenario and was surprised when I found it wasn't catered for. Maybe I'm ...
1
vote
2answers
21 views

issues with creating varchar returning functions [closed]

I have an issue while creating functions in sql server, am very new to sql server Below mentioned is the code which i used, please any issues with syntax. CREATE FUNCTION Fn_Check_Customer_Credit (@...
3
votes
1answer
58 views

Clustered Index Scan (Clustered) vs. Index Seek (NonClustered) + Key Lookup (Clustered)

I have the following tables and content create table t(i int primary key, j int, k char(6000)) create index ix on t(j) insert into t values(1,1,1) insert into t values(2,1,1) insert into t values(3,...
1
vote
1answer
32 views

Remote Connection to SQL-Server for data extract [closed]

I have zero experience with MSSQL Server, but I'm trying to determine the most effective way to extract data from table into flat files from a remote location. Here's the usage case scenario: We are ...
1
vote
2answers
33 views

Maximum Attachment Size in database mail

Good Afternoon, I am trying to send an attachment via database mail. declare @mail_recipients VARCHAR(4000) = 'abc@123.com' , @mail_subject VARCHAR(500) = 'subject' , ...
1
vote
2answers
36 views

SQL Table Design Schema - To Normalize or Not?

I am considering a table schema design for a project. The design involves a Many-to-Many Relationship. The 2 related tables are: a) Class b) Subclass A Class can have many Subclasses, and a ...
0
votes
1answer
51 views

AG (SQLServer 2014) - Suspend Data Movement

I have a primary replica and one secondary. Multiple availability databases. Secondary replica is located at DR site. For DR testing, is it possible to failover to the secondary replica, make (test) ...
3
votes
1answer
231 views

How to avoid implicit conversion for an Integer column

SELECT [BusinessEntityID],[NationalIDNumber],[LoginID],[OrganizationNode] FROM [AdventureWorks2014].[HumanResources].[Employee] where BusinessEntityID = 5 I get convert_implicit() function ...