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
1answer
64 views

How to create a view joining 2 tables? [closed]

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 ...
1
vote
2answers
62 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
0answers
69 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 ...
1
vote
0answers
29 views

Best index to apply for modifier query in i2b2 [closed]

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 ...
1
vote
0answers
58 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 ...
5
votes
1answer
159 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 ...
6
votes
3answers
467 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" ...
-3
votes
1answer
61 views

Which is faster Select Column names or Select *? [closed]

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 = ...
0
votes
0answers
38 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
35 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
vote
1answer
52 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
2
votes
1answer
37 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 ...
1
vote
3answers
124 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 ...
0
votes
0answers
56 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 ...
0
votes
1answer
75 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 ...
2
votes
2answers
176 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 ...
3
votes
2answers
124 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 ...
-2
votes
1answer
62 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 ...
1
vote
1answer
61 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 ...
0
votes
1answer
42 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
111 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
71 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 ...
0
votes
0answers
52 views

SA Admin SQL-Server 2012 x64 keeps changing constantly

I know this is a newbie question, but really I can't find some precise info on this issue. I'm trying to figure out how to create a new user with admin server role on SQL Server 2012 x64. I mean, I ...
0
votes
2answers
60 views

How I convert it to SQL Server please [closed]

How can I create a SQL Server equivalent of this query? SELECT m.ItemId ,item.NAME ,m.Expiratory ,m.t AS TotalNumber FROM item ,( SELECT ItemId ,Expiratory ...
3
votes
0answers
54 views

PowerShell Move-Item command made SQL and Windows entirely unresponsive

A LUN expansion completed overnight on our 15k FibreChannel VMAX SAN from 4 to 13 terabytes. This morning I attempted to move a 4.5 terabyte file from a temporary SATA LUN to the newly expanded LUN ...
0
votes
1answer
49 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 ...
1
vote
1answer
79 views

How to compare data between staging and operational tables?

I just want to ask how to compare two database tables, staging vs. operational tables. After we did the transformation and convert it to correct datatype like convert flag column (Y/N) nvarchar to ...
2
votes
2answers
81 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 ...
0
votes
1answer
29 views

Need some help for choosing the replication type

My target is to create a replication process for the following Please suggest which type of replication is suitable for this architecture, See the image below
2
votes
5answers
140 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 ...
4
votes
1answer
118 views

Order by bug on SQL Server 2005 vs SQL Server 2012

I have a query generated by entity framework that returns wrong results on a SQL Server 2005 db (Microsoft SQL Server 2005 - 9.00.5000.00 (X64)) but good on SQL Server 2012 (Microsoft SQL Server 2012 ...
2
votes
1answer
54 views

Detached database file permissions

I have a script that detaches databases for archival when they meet certain criteria. The script is executed by SSIS under the local Administrator account by the Ghost of DBA Past. Per design it (by ...
0
votes
1answer
21 views

Possible to CREATE EVENT NOTIFICATION with a different owner?

We are in the process of removing a previous dba login and he owns all the endpoints and event notification objects. Endpoints were easy to change; Event notification objects not so much. I found ...
4
votes
4answers
318 views

How does SQL Server determine precision / scale?

I'm running SQL Server 2012 SELECT 0.15 * 30 / 360, 0.15 / 360 * 30 Results: 0.012500, 0.012480 This one is even mor confusing to me: DECLARE @N INT = 360 DECLARE @I ...
2
votes
0answers
59 views

SQL Server not starting at Windows startup but starts manually

My SQL Server instance's (SQL Server 2008 R2 Express) service has Startup Type = Automatic. The past couple of times I've restarted my computer the service has failed to start on its own, but it ...
0
votes
2answers
54 views

Best Way to Migrate 100 tables To New Database

I need to migrate 100 out of 150 tables (data and structure) and everything else (sprocs, views etc.) to a new empty SQL Server database. I have been using the Import/Export wizard and it has been ...
5
votes
1answer
81 views

Should an INSERT cause an exclusive lock on a foreign key?

I'm working on a deadlock issue. Process A is doing a simple INSERT into TableA which has a FK to TableB Process B is doing a complicated SELECT on a join that includes TableA and TableB I'll ...
1
vote
1answer
58 views

Reading a SQL Server Execution plan

I am very new to any type of tuning but have been learning more.. One of my specific databases one of the problems identified with slow queries are a number of Implicit conversions. It is my ...
18
votes
3answers
722 views

Are RANK() and DENSE_RANK() deterministic or non-deterministic?

According to official Microsoft BOL DENSE_RANK is nondeterministic (RANK()). But according to Ranking Functions by Itzik Ben-Gan "... the RANK() and DENSE_RANK() functions are always deterministic". ...
1
vote
1answer
135 views

How to reclaim the unused Space in a database

The database is almost of size 55GB. This database should have never grown to this size as some of the maintenance jobs were not running. I have deleted almost 30GB of data. Now the database size is ...
1
vote
1answer
46 views

Still i am not satisfying with Logfile Shrinking in SQL Server? [duplicate]

Already i asked this question but still i'm not getting the very clear answer. In my server holds more than 20 live databases in that my logfile(.ldf) is use to grow more than 5 GB per day. Using the ...
1
vote
1answer
45 views

Options for Index Defragmentations For Critical Tables

I wonder if this is a suitable solution for index defragmentations. scenario is like this; There is a table named 'Events' which is very critical and has 4 indexes which are not done maintenance ...
1
vote
1answer
91 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, ...
1
vote
2answers
51 views

Did a SQL Server instance ever participate in replication?

How can I tell whether a SQL Server instance ever had replication in use or not? I'm debugging an issue with a 3rd party software. This software (Red Gate SQL Backup) reports the distribution database ...
0
votes
1answer
57 views

Downloading files based on most recent date and timestamp

I have a requirement to download zipped files from an SFTP site using C# and Script Task within SSIS. We have multiple files on the server with the same name, but with different date and timestamps. ...
1
vote
2answers
56 views

SQL Server 2008 R2 Log File Location

One of the databases I am going to support does not have a validate log file location. The drive which the log file is pointing to does not exist. But I don't see any error in database error log ...
1
vote
2answers
115 views

Disabling certain steps in a job

I have a project coming this weekend where all the jobs has to be stopped but only 1 step in a particular job has to be run. for eg: i have a a 2 step job and the second step must run and the first ...
0
votes
1answer
47 views

Select complete next row based on the current row

Hi i have a complicated condition. I have a table lets say 'Test' ID Partner Type Amount 143854 CSTC Purchase -0.81 144029 CSTC Purchase -0.69 144030 CSTC Purchase ...
8
votes
3answers
1k views

Truncated 200GB table but disk space not released

I have only 2GB left, so I need to remove this history table. This table now is empty but the database disk space not released. And the database file is 320GB.
0
votes
1answer
27 views

SQL Server, firewall and linked servers

I have: SQL Server 2008R2 database server in my LAN and under my control (call it LOCALSQL) remote SQL Server, on which I have much less control (call it REMOTESQL), for which I only have IP, ...