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
3 views

Optimize query with sql server

I have the following query .its execution took 15 min .It is too much slowly . Is there a way to optimize it ? Query SELECT Id,Fees,WeekOfMonth,CONVERT(NVARCHAR(MAX), StartDate, 103) AS ...
3
votes
3answers
3k views

How can I search the full text of a stored procedure for a value?

I use the following script to search the text of all stored procedures when I want to find specific values. SELECT ROUTINE_NAME, ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION ...
-1
votes
1answer
22 views

How to create a view joining 2 tables?

I've got two tables that I'm trying to create a view from. The problem that I', having is that the column that I would join on doesn't have all of the same values in both tables. Here are my table ...
0
votes
2answers
118 views

Is it possible to speed up this PARTITION BY query?

I've got a timeserie table. Each datapoint has also a statut field which indicates its providing source. I'd like to request last available datapoint as of date T but there could be several results, ...
6
votes
3answers
295 views

rebuild on clustered index, why does datasize shrink?

When we did a rebuild on a clustered index on a table that have about 15gb data in it and the datasize shrunk to 5gb, how can this be? What kind of "data" is removed? Data size i mean the "data" ...
0
votes
0answers
10 views

Table data synchronisation across two databases

I have two databases that need a couple of tables to be kept in synchronisation. I'm not sure the best way to achieve this as I don't want to write triggers as they often get forgotten about and data ...
0
votes
1answer
55 views

Convert multiple databases into schemas SQL Server

Due to a high amount of databases being created on my project and the rising cost per databases I had the following question: Is there a way to convert multiple databases in SQL Server into one ...
3
votes
2answers
73 views

How does the PowerShell SQLPS SQLSERVER provider detect central management servers in SQLRegistration\Central Management Server Group

I'm experiencing odd behavior with the PowerShell SQLSERVER provider and the SQLRegistration\Central Management Server Group directory. Below are the behaviors. I would like to know how the SQLSERVER ...
1
vote
1answer
26 views

Specifying per-table recovery mode

I have a table that is used for log data; the data is only INSERTed, never UPDATEd. The table has no business data whatsoever, and thus it is not a problem if I cannot recover it in case of a ...
0
votes
1answer
93 views

Need Advice on Normalizing Database

I have a group of database tables that lack normalization. They all have a similar primary key called 'doc_index', which is either a PK by itself or part a composite PK. As you can see below, there ...
0
votes
0answers
22 views

why I can't delete old transaction log backup files with an existing scheduled job?

I have a job scheduled in my SQL Server Agent 2008 R2 that runs every 30 minutes, Its part of a maintenance plan that runs: A daily full database backups, differential every hour, and transaction log ...
0
votes
0answers
13 views

Best index to apply for modifier query in i2b2

Below is a query being run by a tool called i2b2. I'm unable to change how the query is run. What can I do to the indices in "observation_fact" and/or "modifier_dimension" tables so that this query ...
0
votes
1answer
62 views

How to get more information from dm_exec_query_stats

I am running SQL server 2012 on windows azure VM (windows server 2012) I suspected that some of my web appliactions are attacked via SQL injection, So far i could not trace the relevant text with my ...
3
votes
2answers
179 views

Foreign key without referenced columns specification

I noticed in the SQL Server documentation that the list of referenced columns is not a required parameter of a foreign key constraint: <column_constraint> ::= [ CONSTRAINT constraint_name ...
0
votes
1answer
46 views

Why do my backup policies fail when a database's guest user is disabled?

I'm attempting to implement Policy Based Management on a SQL Server 2012 instance also acting as a Central Management Server using the Enterprise Policy Management Framework. The job running the ...
10
votes
2answers
8k views

What is the actual behavior of compatibility level 80?

Could somebody provide me with a better insight about the compatibility mode feature? It is behaving different than I expected. As far as I understand compatibility modes, it is about the ...
1
vote
0answers
26 views

SQLCMD cannot find the SQL Server remotely

I am trying to use SQLCMD to remotely detach a database but for some reason it can't find the server. From the workstation, I can connect to the database instance (which is the default instance) using ...
0
votes
3answers
184 views

Force spool to avoid creating temp tables?

I have the following query which join pivoted data of several very big tables and it runs very slow. I tried to created the temp table for each pivoting and it runs much faster. Is it a way to force ...
5
votes
1answer
100 views

How do I track logins, connections, user accounts, queries, …?

I am a BI person who has been asked to step in and pretend I am a DBA. I am not a novice with databases but AM a novice at the admin type stuff. We have a SQL Server database that is going to be ...
5
votes
1answer
1k views

In a CASE Statement, which is faster: “WHEN [field] in (0)” or “WHEN [field] = 0”?

I'm looking at a stored proc that another guy has written and every WHEN clause is using an IN statement instead of =. My gut tells me this isn't as fast, efficient, etc. For example: CASE WHEN ...
-3
votes
1answer
49 views

Which is faster Select Column names or Select *?

I am writing a Stored Procedure which is joining 3 tables, each table have two Columns. Query 1 : SELECT * FROM [dbo].[PersonInfo] P join [dbo].[Receipt] R ON P.Id = ...
4
votes
1answer
95 views

Find reason long running stored proc SQL Server

I have a stored proc which is called every 2.5 seconds by a program, 24-7. This proc normally runs under the 10 milliseconds. A few times a day (3 -5 times) it takes around 42953 milliseconds to run ...
0
votes
0answers
28 views

SQL-SRS create a report that is evaluated every day

Is there any functionality in the SQL Server Reporting Services to run a query every day and graph the result or do i need to use a seperate table and cronjob to run the query and save the result plus ...
1
vote
0answers
33 views

SQL Server 2014 In Memory Table Creation Error

When I create an in-memory table, I get this error: The data types char(n) and varchar(n) using a collation that has a code page other than 1252 are not supported with memory optimized tables
0
votes
2answers
72 views

How to provision the SQL Server Agent service after SQL Server Edition upgrade

I have upgraded SQL Server 2008 R2 Express to SQL Server Standard Edition. After I have upgraded it, the SQL Server Agent was stopped. I have tried to start but it fails. Only when I have changed ...
1
vote
0answers
26 views

Understanding “Date Last Modified” for “System Stored Procedures”

Whilst reviewing code on a SQL 2008R2 Instance I inspected the Date Last Modified of the System Stored Procedures of the databases. The ones in the DBO schema had a datetime that predates the ...
-1
votes
2answers
106 views

Remove a character from a records enclosed between double quotes

I have a table in which every row have data like: 0150566115,"HEALTH 401K","IC,ON","ICON HEALTH 401K",,,1,08/21/2014 What I want is to remove every comma (,) that is enclosed between double quotes ...
0
votes
0answers
17 views

Something similar to SQL Server's DACPAC (for customizable deployment) for Oracle database [closed]

In one of our software's deployment part, we use database projects that contain scripts with primary data. Upon building, we have DACPACs that the remote teams execute and get basic structure up and ...
1
vote
1answer
216 views

sp_startpublication_snapshot Parameter(s)

I am creating a stored procedure that: Restores a DB from a .bak giving the .mdf and .ldf a new name (so we have have several copies of the same DB up (If specified in the SP's parameter) Creates ...
1
vote
3answers
116 views

Restrict user to only take COPY_ONLY backups

Is there a way to force users to only take a full backup with COPY_ONLY so they don't interfere with diff backups? Dev need to take backups every now and then but they don't always remember to use the ...
3
votes
2answers
352 views

SQL agent job, why is the job history showing that a step is still running even though the job has completed

I have a sql agent job that runs Powershell as its first step (there are 3 steps in total). I have set this step to have 2 retries, with a 3 minute retry interval. When I look into the job history, ...
0
votes
1answer
73 views

Page compression not working?

I have created a table where I have around 100 partitions (per month), all of them are configured to use page compression. After that I'm inserting data to this table month by month. I now would ...
2
votes
1answer
33 views

Create failed for Availability Group 'AGN'

I tried creating availability group (AOH) many times but no luck , It got failed every time. Please help me on this case. I configured Windows cluster (Name as 'WINCLUSTER') with two nodes. They are ...
0
votes
1answer
80 views

Best way set clustered primary key on a partitioned table?

I have the following table. create table T (K1 date, K2 int, K3 varchar(10), C1 int, C2....) The table will be partitioned by K1 (K1 has low selective. the data will be appended in the order by ...
1
vote
1answer
80 views

Index maintenance operations that are ONLINE in Standard Edition: Is table Read-Write or Read-Only?

As we understand it, related to SQL Server 2008 and above: ALTER INDEX ... REORGANIZE Is on ON LINE operation in ALL flavors of SQL Server. ALTER INDEX ... REBUILD Is a BLOCKING operation, ...
0
votes
0answers
45 views

Prevent gaps while using Identity/sequence object in sql server

I have a table and I am trying to insert values in it. I want to prevent gaps in the primary key column. For primary column I have tried using Identity / sequence objects. I know that this is ...
6
votes
2answers
1k views

SSRS appears to be ignoring Permissions set using Report Manager

I have setup SSRS on SQL Server 2008 in native mode. As an administrator I can login to report manager, upload reports and run them, and also use the Web Service URL to generate reports. I have also ...
2
votes
2answers
165 views

Large queries are slower in SSMS

I have a large table, about 750M rows. I have an application using Entity Framework to load and parse data, a query that returns 2 million rows takes 4 seconds. The same exact query takes 8 seconds ...
0
votes
1answer
54 views

Slow running aggregate of aggregate query

I am looking for the total balance for all accounts that had a negative balance as of a specific point in time. I've already got the code below, and it works, but works horribly. The transactions ...
2
votes
5answers
120 views

Transferring large amount (84 million rows) of data efficiently

I have about 84 millions rows. Of those all of them needs to be transferred to a separate database on the same server, then I delete to delete about 60 millions rows from the source database. The 84 ...
1
vote
1answer
52 views

Backup the whole SQL Server databases in one .bak file - SQL Server 2005

First I asked my question here: Migrate all databases from one SQL Server 2005 to another Many friends replied to it and I gathered lots of useful information. I have another scenario in which we ...
1
vote
2answers
289 views

SQL Server 2005 upgrade service pack via command line

I have been wracking my brain over upgrading sql server 2005 to sql server 2005 sp4. I have a script for installing new instances of sql servers for all versions and they all work wonderfully. Problem ...
-2
votes
1answer
54 views

How do I get to this query? SQL Server

I have a database schema : member(memb_no, name, age) book(isbn, title, authors, publisher) borrowed(memb_no, isbn, date) This is the question: For each publisher, print the names of ...
0
votes
1answer
222 views

SQL Server replication - set PollingInterval in sp_addmergepushsubscription_agent

I am trying to create replication subscriptions to and SQL Server 2008 R2 via a script. There are 3 subscribers so this script creates the subscriptions by calling sp_addmergesubscription and then ...
2
votes
2answers
78 views

Reviewing all code on a SQL Server Instance

Shortly our development team will be moving an existing SQL Server 2008R2 instance into our Production environment. Ahead of this I have been asked to review all the code on it for anything malacious ...
2
votes
2answers
855 views

Loop through all databases and remove all users

We are doing a conversion from one system to another which is requiring backup/restores. I am trying to create a process that will remove all users after the restore on the new servers as no user ...
0
votes
2answers
234 views

SQL Server Permissions

I have create a user and grant many permissions and roles to it including SQLAgentUserRole and SQLAgentReaderRole. My application check the status of agent if it is running or not and whenever I am ...
0
votes
1answer
31 views

Finding dependencies on a SPECIFIC COLUMN (modern way, without using sysdepends)

I need to find all views & stored procedures that consume not just a certain table, but a specific column in a table. The following "seems" to work, but there are numerous warnings to be careful ...
7
votes
1answer
93 views

SQL Server trace based on client TCP port

I have a Windows terminal server with many different users logging in via RDP to run an application. The application makes one or more connections per user to a SQL Server 2008 R2 instance. All users ...
0
votes
1answer
45 views

Raising an Alert with THROW

It seems to me that SQL THROW is missing a crucial feature that RAISERROR has, and that is the abilty to use WITH LOG so that an Alert can be fired when the error number is logged in the Application ...