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
2answers
39 views

Display Total under name column and sum of amount under sal column [closed]

in a table empno,ename,sal,hiredate is there. but i want output is empno ename sal hiredate 122 ganga 2000 1989-02-06 123 reddy 3000 1986-06-02 Total 5000 here empno, hiredate column ...
1
vote
1answer
28 views

Reclaim unused space

I have a DB 150 GB , contains 138 tables one of the tables is 120 GB. I need to archive around 80 GB from this table. Is there a way to reclaim this space without using DB shrink? thanks
1
vote
1answer
59 views

Is it Possible that a variable name changes in a stored procedure after a restore?

I often restore my Testing database from Production db, but this time I noticed something odd: we have a stored procedure called (USP_AddTS), one of its variable names have slightly a different name ...
4
votes
0answers
39 views

SQL Server: Unable to save import export package, but am on Standard Edition

I am confused. Issue: SSIS ("SQL Server Import Export Wizard") should let me build a data import package and save it to a file, for easy re-running (converting to a task, etc.). I want to save a ...
1
vote
1answer
25 views

What is the relationship between the SSIS Package Store and Catalog?

I have a server with a working installation of the Sql Server 2012 SSIS Catalog. I need to set up an additional instance including the SSIS Package Store service as an interim step while the packages ...
1
vote
1answer
33 views

Most efficient table storage for determining recurrence

What is the most optimal table structure to store schedules / recurrence definitions so that we can efficiently query it for all events that will occur within a date range (min:1 max:32 days)? My ...
1
vote
0answers
41 views

SQL Server tool for merging rows [closed]

We have a SQL Sever 2008 database that occasionally receives bad data from customers. The issue we are trying to address here is that sometimes duplicate records are created where one row has some of ...
2
votes
1answer
52 views

Process Data cube from job on SQL server

I have an SQL Server Agent job on server(X) that has a step that is supposed to process a data cube on a remote server(Y). Whenever I run the job it fails and says that server(X) does not have ...
3
votes
1answer
39 views

Determine Gap Records, Fill and Return Result

The following working code targets SQL-Server 2012 and I have distilled the actual problem into a manageable scenario with the code example shown below also presented on SQL Fiddle. I seek feedback ...
0
votes
0answers
39 views

Refactoring 80 GB table that stores massive amount of calculated results

Trying to evaluate architectural changes to improve the performance of an app that calculates a lot of individual values and stores each of these results as a row. The storage size for one of the ...
2
votes
1answer
37 views

Best way to back up data bases on a SQL Server Availability Group DR Site node

I have an Availability Group (Primary only is readable) with 2 nodes locally and 1 node at a DR site. Both sites have a backup system. Locally, I’m using the local backup system to back up the AG ...
3
votes
2answers
45 views

Historical dbcc checkdb results

Is there a better way of accessing historical dbcc checkdb result history (if output logging was not used at runtime) than xp_readErrorLog? EXEC xp_readErrorLog {0-20}, 1, N'CHECKDB'; SQL Server ...
2
votes
0answers
29 views

SQL Server database suspect

All the databases went to suspect mode on a server. Tried bringing on-line by taking emergency but did not workout . Have restarted the server as there is disk I/o error still in suspect mode. Can ...
1
vote
0answers
13 views

Could not redo log record on mirror

One of my database mirrors is in the suspended state today and the error log on the mirror shows the following. Could not redo log record (338934:102862:477), for transaction ID (0:848150408), ...
-1
votes
1answer
32 views

Insert id into another table and give the item another id that is autocrementing?

Need this answered if anyone can help. I need to create a query that will automatically insert ordID, but give it a new auto incremented OrderNumber in Orders.dbo. Fiddle is below: ...
0
votes
0answers
26 views

differential Database Backup and Restoration [closed]

hi i am running with errors while restoring the differential database backup for my surprise initially it works but when you schedule it goes wrong here is the script for backup what iam using for ...
0
votes
0answers
27 views

Shrink database or DB files not reducing size even after dropping biggest table

Our MDF file was originally 550GB in size (log is just 10MB), and the biggest table we had [HourlyCounters] was 140 million rows with 580 columns (varchar[50]). It's a table with a very inefficient ...
0
votes
0answers
18 views

Proxy for MDW data collection on remote servers - SQL Server 2012

I am trying to setup data collection (for disk usage) from remote servers and upload it to my MDW database. I understand I will need a proxy set up for the agent to do this but which subsystem to I ...
3
votes
3answers
367 views

Convert date yyyy-mm-dd to integer YYYYMM

How can I convert @dateb: SET @dateb = dateadd(month, datediff(month, 0, getdate()) - 3, 0) that returns 2014-04-04 as date to an integer of 201404 Thanks
0
votes
0answers
16 views

Shrink database or DB files not reducing size although I dropped biggest table

Our MDF file was originally 580GB in size, and the biggest table we had [HourlyCounters] was 140 million rows with 580 columns (varchar[50]). It's a table with a very inefficient schema, but there's ...
0
votes
0answers
10 views

Hide table object from db_datareaders

Is there a way to grant select on a view without having to grant select on the underlying table object too? Problem is: 2 users share the same table. Both currently have db_datareader privileges. ...
1
vote
1answer
21 views

Attach Database is disabled in Microsoft SQL Server 2012 Management Studio

I have buy from Godadday hosting and domain, after that I have create database in godaddy and the connect to this db using my authentication. I have .mdf, .ldf that need to attach to the connected ...
4
votes
1answer
32 views

Limiting Domain Admins permissions on a SQL Server

I have a SQL Server 2012 machine and I want to limit the Domain Admins permissions. What can I do to make sure that the Domain Admins have read only permissions for the databases and nothing else for ...
0
votes
1answer
38 views

Failed SQL Login - Source server same as destination cannot locate SPID SQL Server 2014

Bit of a confusing one here. We are getting repeated messages in the SQL Server error log as below for a SQL Server instance: NT AUTHORITY\SYSTEM Reason: Failed to open the explicitly specified ...
0
votes
1answer
57 views

SQL Server transactional replication issue with database

We have on the server a database and we want to replicate a database on another server. we've set a transactional replication, but we have issues with the default constraints on the tables: On the ...
0
votes
2answers
48 views

Auto increment a value using cursor in SQLServer

I am developing an employee leave management system and My table structure with data is : +-----------+---------+----------+----------+------------+--------------+ | EmpID | CL | PL | ...
0
votes
1answer
27 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
48 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
92 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
80 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
79 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
369 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
64 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
35 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
28 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
66 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
32 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
20 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
19 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
16 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 ...