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)

1
vote
1answer
81 views

What is an index KEY - emphasis on KEY?

In SQL Server, What does the 'key' part of the phrase 'index key' mean? Is the key a number? what is it? If I have the table of data containing a column called LastNames, and I have, say, a clustered ...
0
votes
2answers
56 views

Identy Column To Generate Flag Values

Sometimes there is a need to have the rows of a table have a flag type value which can be and-ed and or-ed by the end user. This of course can be accomplished by creating a new column or putting in ...
2
votes
0answers
77 views

Is it possible to have different authentication mode for SQL Server Database Engine and corresponding SQL Server instance?

I have installed the x64 SQL Server 2008 R2 Express with default settings and run MBSA 2.3 Microsoft analizer (using default settings too). Tried on clean Windows 8 installation (not 8.1) and Windows ...
0
votes
1answer
61 views

SQL Server 2008, problem with backing up transaction log

I have a transaction backup job which runs every hour, first it backups up from the database log to another drive then it shrinks the log and deletes old trn files. The middle task shrinks the log ...
3
votes
1answer
63 views

How to check the timezone for a given datetime?

A database / table I'm working it saves all its date values as datetime (without a timezone). How can I find out which timezone that date was in? For instance, the Central European Summer Time (+02) ...
0
votes
0answers
41 views

What is the difference between normal Select query and a Select query inside Common Table Expression(CTE)? [duplicate]

I'm having a table 'Products' and if Execute this query SELECT TOP 1000 [ProductID] ,[ProductDesc] ,[ManufacturingDate] ,[ExpiryDate] ,[Price] FROM ...
1
vote
1answer
57 views

How can I switch to sa account from guest session in 2012 sql server?

I have a situation where I can log into my server as guest, and see that there is no password on the sa account. However when I try to login as sa with null password over the network it is rejected. ...
3
votes
0answers
61 views

Why is my SQL Server query behaving differently on UPDATE than on SELECT?

I've written a SQL Server query that updates records to have a sequential number after partitioning on a field. When I run it as a SELECT statement, everything looks great: DECLARE @RunDetailID INT = ...
0
votes
1answer
35 views

Poorly Performing Query - SQL Server Best Practices

What are the levels for the following counters below where it is a considered a poorly performing query? I am looking at setting Idera SQL Diagnositic Manager and it asks me this question when I try ...
1
vote
1answer
49 views

Grouping() equivalent in PostgreSQL?

I have a SQL query that runs in MS SQL Server and it has grouping(), rank() and rollup() functions / keywords in it. The query is given below. How can this be translated to PostgreSQL? select top ...
0
votes
2answers
41 views

Grouping rows by looking at two columns without considering the order and summing each separately

I have a table looks like this one below: +---------+---------+-------+ | SOURCE | DEST | VALUE | +---------+---------+-------+ | A | B | 1 | | B | A | 2 | | A ...
0
votes
0answers
21 views

Risk in evicting node from SQL Server cluster without prior uninstalling of SQL Server binaries

I have to perform upgrade of a SQL Server failover cluster with several SQL Server 2005 instances running on two Windows Server 2003. Since the plan is to have servers running Windows Server 2008 and ...
4
votes
0answers
45 views

Instant File Initialization on Shared drive

I asked something similar to this before, but previously I had asked about moving backups to a shared location. This time I am curious, if I want to restore a DB on a shared drive, do I need to enable ...
1
vote
0answers
47 views

Upgrading SQL Server from 2008 to 2012 doesn't respect existing install / instance paths

Basic Information : Running Microsoft Windows Server 2008 with MS SQL Server 2008 (version 10.0.5869), trying to upgrade to SQL Server 2012. Currently working in a cloned VM of our production server ...
0
votes
1answer
63 views

SQL Server hitting System.OutOfMemoryException but server has 10GB free

SQL Server 2012 11.0.5058.0 I'm running a very large batch of queries (about 2700) to simulate a user doing X, Y and Z in our app. I have SQL Server's max memory set to 2147483647 MB. However when I ...
1
vote
1answer
44 views

Convert Varchar Duration time to time

I need my code to add the varchar CPUTM field + varchar CPUZIPTIM field which both has time values to see if greater than 2 hours. How do I do this when both fields are varchar. The value in CPUTM ...
3
votes
2answers
83 views

Restore db with encrypted column in SQL Server, without overwriting existing Service Master Key

Scenario: Server1 running SQL Server 2012 with Service Master Key A, db1 with Database Master Key 1, symmetric key and certificate available. Password used to protect the DBMK 1 is unknown, ...
0
votes
0answers
20 views

SQL Server Transaction Log Huge [duplicate]

I came to work today and I saw the transaction log with 441GB, using almost all disk space. I use SQL Server 2012 and have Full backup, but somehow I lost control of the t-log. So, I need to do 2 ...
0
votes
2answers
49 views

How to use sqlcmd to create file names for output based on the day of the week or the date?

I have a SQL agent job that queries the database and exports the results into a csv file. It needs to run daily and The output file (Output.csv) gets overwritten everytime the job runs. Is there a way ...
0
votes
1answer
46 views

Searching between dates on a CHAR type field

I have a table that has a field in which dates are stored, the problem is that the field type is CHAR(10) and I'm being asked to query for data between certain dates. I don't want to change the field ...
1
vote
2answers
63 views

Referencing a single table from all tables in the database

At current, I have around 130 tables in my database, anticipating a growth of circa 200 tables in total. Now I have several tables (well, most of them, actually) that contain properties like ...
2
votes
3answers
61 views

Bulk change Agent Jobs' definition to “Quit the job reporting failure” from “Go to the next step” On Failure

There are agent jobs with multiple steps in our servers and all their steps are defined as "go to the next step" "On Failure". So, even a job step fails, operator doesn't get notified because ...
2
votes
1answer
42 views

Can I split lines into Elements with For XML?

In this example I'm cribbing from a previous question, My source table has a varchar(max) field that I want to split by line into individual elements with FOR XML as I query it. Given this data- ...
0
votes
1answer
34 views

logging in Bulk logged recovery VS Full recovery model

I am trying to understand the logging aspects in Full and Bulk recovery models.As per MSDN ,select * into test from abcsd is logged minimally in Bulk logged ,but in full recovery model,it is logged ...
1
vote
1answer
56 views

MDX Max, Average and StDev functions not giving correct results

I have a scenario where I have Date dimension and Time dimension along with some other dimensions. The time dimension contains only Hours since there was no need to save data at minute or second ...
0
votes
0answers
29 views

Database still reports 600GB after removing 500GB File

I have a database with three files Log Primary Data File Blob Data file the database was becoming too big to manage (600GB) so we removed the blob data (500GB) into FileStorage outside the DB. ...
5
votes
2answers
130 views

Sporadic execution time causing timeouts [closed]

We have a table with 100 million records holding 24 hour worth of data of our clients' customers actions (actions which are performed on 3rd party sites and replicated from there to our server) The ...
2
votes
2answers
46 views

Is Policy-Based Management dead? Is it scalable?

Policy-Based Management was introduced in SQL Server 2008. I'm looking for software/tool I can use to enforce configuration standards across a SQL Server 2012 /2014 database environment. Instances ...
1
vote
2answers
65 views

Maintain Up-To-Date Copy of Very Large Table if Clustering/Partitioning/Moving Operation Needs to be Killed/Rollback

I've appended the following information in a previous post but I asked the 'why' instead of the 'how'. So here's the question... SQL Server 2014, CU6. 4.5 TB database, Simple recovery. The most ...
0
votes
0answers
24 views

Is it possible to target a specific instance in a clustered environment with group policy?

Not sure where to ask this, but here goes: I'm in a clustered environment, not the primary DBA (and he's not very AD/GP savvy either) and I'm being asked to set security permissions for an AD Service ...
0
votes
1answer
43 views

Server-wide Database Permissions in SQL Server

We have a SQL Server 2014 installation, which is accessible by a subset of our Active Directory users via Windows Authentication. Currently, when they log into the server for the first time they are ...
0
votes
2answers
50 views

Database logs growing during maintenance plan

I have read several threads and sites about SQL logs but I don't feel I have found the answer. Or if I did I did not understand it enough to address my issues. My issue: When I run my SQL maintenance ...
0
votes
1answer
57 views

How comes that login with no rights cam give himself db_creator?

I just created a new login using the GUI, which generates this script: USE [master] GO CREATE LOGIN [tester] WITH PASSWORD=N'tester', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF ...
2
votes
2answers
127 views

SQL Server: Recursive dynamic SQL puzzle

I was looking at this post of trim all columns of a table. In the answer query script the column names gets concatenated without any looping operation. I simplified it to check its work flow as ...
0
votes
0answers
26 views

Integrating Postgres/GIS data in a SQL Server environment without generating 'data islands'

Currently I'm facing a scenario in which a GIS expert is planning on starting to integrate mapping services for several departments within the organization I work for. I handle around 40 mid-sized ...
0
votes
1answer
45 views

Improve sql server lookup table performance [closed]

We have a sql server database (on azure) with one large table c1billion rows. Each row consists of a key char32 which is an md5 hash and a value int. All queries select multiple values from the table ...
1
vote
0answers
43 views

Can I restore a SQL Server 2014 backup to SQL Server 2014 Express [closed]

Can I restore a SQL Server 2014 backup to SQL Server 2014 Express? I am given a backup of a SQL Server 2014 database and I need to do some development task on it. I was just wondering what option I ...
0
votes
1answer
49 views

Difficult Query: Can Only Modify The WHERE Clause

Table tblDistResell (the first row is the column headers): DISTRIBUTOR RESELLER STATE ABC BestBuy CA ABC RadioShack NJ XYZ BestBuy CA XYZ RadioShack MO ...
6
votes
0answers
155 views

Is sys.stats_columns incorrect?

Let's say I have a table Foo with columns ID1, ID2 and a composite primary key defined over ID2, ID1. (I'm currently working with a System Center product that has several tables defined this way with ...
1
vote
2answers
50 views

What is the best way to compare values of whole tables between many databases?

We are trying to compare the values of whole tables between many databases. The user can enter in input the table names and the columns names, and the database names he wants to compare. They can ...
1
vote
1answer
50 views

Deadlock scenario, where is this S lock coming from?

I am encountering the below deadlock scenario. Please see the attached object definitions and execution plans. The plans were pulled out of cache from a system where this deadlock does occur. I ...
0
votes
0answers
22 views

How do I abstract a WHERE clause condition?

I'm wondering how a condition in a commonly used WHERE clause can be abstracted away so that it can be safely changed. Say I have data like ColA | ColB | ColC ================== 1 | 2 | ABC ...
0
votes
1answer
27 views

Any reasons trigger AFTER INSERT would not fire?

Context: We're using microsoft sync framework in our project. Sync creates triggers AFTER INSERT, DELETE, UPDATE triggers for tables that are provisioned to sync. the framework also creates tracking ...
1
vote
2answers
31 views

To what extent can we monitor jobs/suspended queries as DBO

Short Background: I work for company A, at company A we have a DBA that should not be. When we are tasked with items for troubleshooting which require quick turn around, it generally takes quite a ...
0
votes
1answer
52 views

Parent-child Relationship with data scattered between these records

I have a 60 column query that fills in a card on an application. The problem I am running into is gathering all the parent-child relationship data into one record per child. As a quick example: The ...
0
votes
1answer
73 views

More Best Practices To Updating Large Tables?

I know there are a number of topics on this question, but I'm always seeking more insights. I have a large table with a billion+ records. The amount of records could be reduced and archived, but the ...
0
votes
1answer
26 views

SQL Server Replication with 2 systems in different locations

I have 2 Servers with static public IP Addresses located one in UK and another in US. Can I implement SQL Replication on these 2 servers located in 2 different locations accessible via public IP ...
0
votes
0answers
34 views

Mirroring via dedicated NIC between two multi-instance clusters

Scenario: Two node SQL Server 2012 cluster in Primary Site. Two node SQL Server 2012 cluster in DR site. Both sites connected via general MPLS network. Replication line available between the two. ...
0
votes
1answer
4 views

is it possible to rollback only a partition/subpartition?

Is it possible to create a savepoint and to rollback only a partition of a table? Lets assume I created a monthly partition and subpartitions with a group_id for table x. Now i run some stored ...
0
votes
3answers
33 views

Move result of a query from one server to another table on another server

What are my options in moving result of a query in one server to another table on another server? Data contains ~400.000 rows so it won't be a quick one. (Both of them are SQL Server 2008 R2) ...