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

Pass parameters to a procedure with SQLcmd

I use this SQL command: sqlcmd -v first_date="30/09/2015" last_date="15/09/2016" And I would like to pass that parameters to a stored procedure: ALTER PROCEDURE [dbo].[_testProcedure] WITH ...
2
votes
2answers
39 views

SOS_Scheduler_Yield wait type

I am having a process that has a last_wait_type as SOS_Scheduler_Yield and is inserting 100 records to a table. This process has been with this wait type forever with low CPU utilization %. There are ...
3
votes
1answer
50 views

How to create a login and user that can only access one schema in one database

I have executed the following: USE [MyDatabase]; GO CREATE LOGIN [MyDomain\MyAccount] FROM WINDOWS WITH DEFAULT_DATABASE=[MyDatabase]; CREATE USER [MyDomain\MyAccount] FOR LOGIN [MyDomain\MyAccount]; ...
3
votes
2answers
61 views

Applying GROUP BY when using multiple CASE WHEN

select e_id ,CASE WHEN w_id in ('1','2') THEN w_id ELSE 0 END as new_w_id ,CASE WHEN w_id = 1 THEN fee END as value1 ,CASE WHEN w_id = 2 THEN fee END as value2 ,CASE WHEN w_id not in ('1','2') THEN ...
1
vote
0answers
23 views

Endpoint acting as a mirror and witness?

Let's say I have 4 SQLServer 2012 R2 divided into two mirrors: SQL1-1 with its mirror SQL1-2. The Witness is SQL2-2. SQL2-1 with its mirror SQL2-2. The Witness is SQL1-2. The mirorring has been ...
4
votes
2answers
95 views

How to backup MS SQL Server databases off-site?

Microsoft SQL Server supports backing up to remote network locations only by means of UNC names the SQL Server (and user account it's running under) has access to. Is it possible to create backups ...
1
vote
2answers
81 views

SQL Server 2012 and DBM

Why would MSFT would deprecate mirroring from 2012.. I understand alwaysON will replace it but then SE users are left with nothing..no alwaysON or dbm from future releases.. Just analyzing from end ...
0
votes
1answer
40 views

SQL Server: INSERT in transaction locks the table until transaction finished

The sample VB.Net code below gets stuck and times out at the first read operation on CMD2. That seems to contradict the top ranked answer to question 6374. If that answer was correct, what can help ...
5
votes
1answer
81 views

existing foreign key that references fields with different datatype (char(8) and varchar(8))

This is more a quest for information that a request for help... I'm upgrading some old databases (running on sql 2005 and compatibility level 70, I suspect they are online since sql 6.5) to get rid ...
4
votes
3answers
370 views

How can I convert a key in a SQL Server deadlock report to the value?

I have a deadlock report that tells me that there was a conflict involving waitresource="KEY: 9:72057632651542528 (543066506c7c)" and I can see this: <keylock hobtid="72057632651542528" dbid="9" ...
1
vote
1answer
65 views

select query on Temp table is not returning data in correct order even after specifying index hint [duplicate]

In my code, I am creating a temp table using select * into #tempTable. Temp table contains the huge number of records and I need to retrieve data from it many times in my code so I created a ...
2
votes
3answers
56 views

Using variable for database name

I am having difficulty in using a variable name for the database. The below script searches through all databases and finds database that match a certain condition. The matching databases are added to ...
0
votes
0answers
18 views

Deploying Shared MS Access DB — Summer Intern first time with Access

So to give a brief background I've got a summer internship and was asked to modify and add features to an already existing MS Access DB. I don't actually take databases until next semester, so I was ...
4
votes
1answer
37 views

Do multiple SQL Server instances increase security?

Context Let's assume you have a server which exposes a web server and one or more web services to store and manage sensible information about physical persons (assume, for this example, complete ...
1
vote
1answer
29 views

SQL Server full text search query takes way too long to execute

I've got query snippet as follows: SELECT * FROM CONTAINSTABLE(dbo.Analysis, *, 'FORMSOF(FREETEXT, "historic year-on-year exchange rates forecast year-on-year exchange rates")'); I'm running it on ...
4
votes
0answers
67 views

The curious case of HADR_SYNC_COMMIT waits

We are noticing an interesting pattern for HADR_SYNC_COMMIT waits in our environment. We have a three replica; one primary, one sync secondary and one async secondary in a datacenter and we just added ...
2
votes
1answer
34 views

Powershell - SQL Server - connectionstring in loop for multiple Instances

Thisis part of a bigger script which finds DatabaseFiles on a SQL Server machine (multiple instances). Following should just return all files for 3 instances. The server is called V3000801 and ...
2
votes
1answer
21 views

Managing the Service accounts in large environment

I wanted to know if there's a best practice in regards to secure a large environment of SQL Server instances (version 2000-2012). Currently the SQL services are running with many users and I'm trying ...
2
votes
1answer
58 views

What are the best practices for restricting write-access on a specific table?

I have a table, which I'd like to be read-only, except for a few specific stored procedures which need permissions to UPDATE rows in the table. After that, I want only a select group of additional ...
1
vote
1answer
20 views

SSRS in database server

Is it advised to use SSRS in the database server itself? Will it hamper the performance of the server itself. (in SQL SERVER 2005) What are the merits and demrits of the same?
0
votes
0answers
17 views

Options for reducing transaction log size when disk space is restricted [duplicate]

I have a very unfortunate situation in which I have some SQL Server (standard edition) databases living on a small (~120gb) disk, and a transaction log which has grown to 50gb+. Unfortunately, the ...
0
votes
1answer
19 views

How can SQL server AlwaysOn AG can be used as a DR feature?

I'm using AlwaysOn ag feature as a HA feature where automatic failover is possible.. I was thinking to log shipping as DR but there is potential data loss in that.. thinking of using ag as a ...
5
votes
1answer
59 views

No service broker active on database

I am trying to set up query notification however when I try to create a queue and service I get the error 'There is no Service Broker active in the database. Change to a database context that contains ...
1
vote
1answer
64 views

Is it ok to create additional column for helping other column to be a PK?

Let's say a Person can have more than one nickname. He(she) must enter his(her) nicknames alongside with other details: Here is the table columns: User_Id, Nickame, Age Of course, for now there ...
4
votes
1answer
49 views

Query Notification setup

I am relatively new at playing around with this and have been trying to follow a tutorial on setting up in the section named "Prerequisites to Create SQL Notification Requests" within this site ...
2
votes
0answers
32 views

SQL Server 2012 replication setup on routed network

I'm trying to setup replication between two SQL Server 2012 instances. I set up a publication successfully on server1, but then I had a problem when trying to access it from server2, because the only ...
2
votes
1answer
69 views

Query takes longer as domain user than local admin

I have an application that runs ad-hoc queries to a remote SQL server. I'm running into a bizarre problem with the application taking significantly longer to return results when the application is ...
1
vote
1answer
51 views

Oracle 12c Client to 10g Server (OPENQUERY)

Scenario: We currently have a SQL 2008 R2 server (with Oracle 10g Client) using OPENQUERY to return data from an Oracle 10g database. Problem: We would like to upgrade to SQL Server 2014 SP1 (with ...
6
votes
2answers
154 views

nvarchar(max) converting to varchar and table optimization

I am working with a table that has all character types set to nvarchar some of them are nvarchar(max). We are converting all these to varchar and specifying a character width based upon the actual ...
1
vote
0answers
18 views

Test Failover SQL Server 2012 [closed]

I have created simple FAILOVER cluster in SQL Server 2014 on Windows Server 2012 R2. This is my development lab and never worked on have a fail over cluster with SAN. As this is my development lab ...
0
votes
0answers
31 views

Stored procedure return -1

Normally, when I execute a SP, it returns a value of zero (0), but I have a SP is returning a -1 and can't figure out why. Does the -1 indicate an error? If I copy all the SP code into a separate ...
0
votes
0answers
29 views

What is the recommended RAID configuration for data Warehouse? [duplicate]

I am trying to understand if there is RAID best for data warehouse.( for version SQL Server 2012 or 2014). so What is the best RAID for data Warehouse performance wise? What is the recommended RAID ...
0
votes
2answers
48 views

Doing a left join and having every match include an extra null row

So I want to do a left join and have every row on the left table include a row of nulls on the right, even when there is a match. Is there a name for this type of join? And is there a better way to ...
0
votes
2answers
27 views

SSMS fail to connect localhost SQL Server 2008 R2 suddenly [closed]

Until today when accessed by remote desktop to my sql server could connect using localhost, but suddenly I cant (without any update or change in my server), now I can connect using localhost\instance ...
0
votes
1answer
34 views

Allowing a user to view/edit only a specific table in a database with ~50 tables

The database I'm working with has about 50 tables in it. A single user requires edit permissions on one of the tables, but should not have access to any other tables. I know how to deny her the ...
0
votes
2answers
21 views

Possible to upgrate SQL Server 2012 express to 2012 Standard?

I need to do an in place upgrade of SQL server 2012 express to standard without losing any data. Is this possible? Is it as simple as just running the setup for the standard version? TIA
3
votes
1answer
363 views

Benefits of SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

I use SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED in the majority of my general SQL queries, mainly because this was drilled in to me when originally learning the language. From my ...
2
votes
1answer
65 views

Multiple indices on a table

I have run SQL Profiler and I can see that I'm "missing" some indexes (non-clustered) on a table. How is it best to handle indexes that can be a "subset" of another index? Index 1 UserId, ...
1
vote
2answers
70 views

How to break down RELATIONAL data into HIERARCHY data structure?

I have a query that returns the following dataset: RELATIONid MAPid D1id D2id D3id 4999 4999 626 1250 7 5000 5000 626 1250 8 For the next step, I need to bind those ...
2
votes
2answers
26 views

Indexing order by columns

Based on the query below it was suggested that I create an index on the column in the order by clause. My understanding is the sorting is done on the result set and not the table. The person ...
3
votes
0answers
43 views

Need a way to prevent log shipping from kicking users out

We have SQL Server 2012. A service we use requires us to use log shipping, however we are tired of having users being kicked offline every 15 minutes. Are there any creative ways to get around this ...
5
votes
1answer
63 views

Can CLR execution continue after 'THROW' is encountered in T-SQL?

I am calling a T-SQL stored procedure from a CLR stored procedure. and the THROW statement in T-SQL stops the execution of CLR without going into the catch block. Is there something I can change in my ...
1
vote
2answers
20 views

SQL Server - Copy data from restored version to live database table

I am using SQL Server 2014. I have a database called LabDB. I have a issue where some data was deleted in the database. What I like to do is to restore the backed up version of the database in ...
2
votes
2answers
35 views

Weblogic Error: Connection test failed [closed]

I am trying to create a SQL Server 2014 data source in weblogic through admin console. When I click on test configuration, I get the following error: Message icon - Error Connection test failed. ...
0
votes
1answer
60 views

execution plan question

I have this query running for long time (@P0 nvarchar(4000)) select emaildmo0_.Id as Id7_ ,emaildmo0_.CreatedDate as CreatedD2_7_ ,emaildmo0_.EmailAddress as EmailAdd3_7_ ...
0
votes
1answer
36 views

Multiple Cascade Paths (Not really) - Sql Server

In my database I have a table with 2 columns referencing the same column in a separate table. I know this creates a race condition, but I have a check in place to make sure they don't point to the ...
3
votes
1answer
38 views

Execution plan for COMPUTE BY

I understand that the COMPUTE BY feature is deprecated. Out of curiosity I would like to know how the query processor executes a COMPUTE BY query. The execution plan does not contain any hint: How ...
2
votes
1answer
82 views

Update one column based on count of records of grouped value in another column

Given a table CREATE TABLE TABLE_ITEMS ( serial_num int null, item_group int null ); INSERT INTO TABLE_ITEMS VALUES (0,1), (1,1), (2,1), (3,1), (4,1), (0,2), (1,2), (2,2), (3,2), (4,2), ...
0
votes
0answers
75 views

view server state permission was denied

The strangest thing is happening on my SQL Server Management Studio. When I right-click any table, I get a "VIEW SERVER STATE permission was denied on object 'server', database 'master'. (.Net ...
2
votes
1answer
30 views

Local SSMS client is not connecting one particular server

My SSMS is not connecting to one particular server say X except X it is connecting to all the other servers. Could not find the root cause for this problem do any one have idea here? Guy sitting next ...