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)

3
votes
1answer
304 views

Storage size of a bigint table

I am working with a table that has this format : CREATE TABLE dbo.ID_STORE ( WORKING_ID bigint PRIMARY KEY CLUSTERED ) The table stores around 2 millions rows, but the stored ids are not ...
2
votes
1answer
74 views

MS SQL high tempdb disk I/O during merge replication of BLOBs

Having a merge publication for replicating BLOBs (sql type - image), got very high tempdb disk I/O for my size of data. Publication is download-only and has no filters. High disk I/O is caused by ...
0
votes
2answers
40 views

MS SQL Server 2008 Transaction log file back up failure

I've done some reading around this subject here and on StackOverflow but nothing really answers my question enough for me to go forward. I'll explain we have a MS SQL 2008 server running, the ...
5
votes
3answers
200 views

Check if any of the values is in a subquery result

I have a complicated subquery that returns a list of order IDs. I need to get a list of customers who have these orders. The problem is that there are two ways of assigning a customer to an order (one ...
-1
votes
2answers
55 views

SQL query to group different data seperately in the same table [on hold]

I would like to know how to construct an SQL query to group different subsets of data in the same table to get the count of each item in a horizontal result set. For example, the query against the ...
1
vote
1answer
22 views

How do I optimise XPath Querying over a large dataset?

I have a table that has 220 M rows. Also the table has a xml column that has XML data. I have configured single file for data and another ndf for index. Table's primary key is guid column. When am ...
-2
votes
0answers
33 views

Previously running query taking very long execution time [on hold]

I am having some cache tables which are populated hourly from main tables. After few days(a week) suddenly select statements on these cache tables start taking a long time. Can you please help me on ...
-4
votes
0answers
32 views

**Homework/Research** for future Database Administrator [on hold]

Considering I am pretty new to software development/programming I decided to do a technical writing report researching what programming languages are best suited for students wanting to pursue a ...
-2
votes
0answers
34 views

How do I join these queries into one query? [on hold]

I have these below queries. How do I join these 3 queries into a single query? 1st query: SELECT TOP(1) @tmpOnlineCat = ac.AlertCatID FROM alert.AlertCategory ac WHERE ac.FkAlertID = 2 AND ...
0
votes
2answers
67 views

Sql Agent Jobs executes too slow

I have posted a question like this before but is seems that I did not explain the whole story clear. So I made this one to explain it in details. Here's the stored procedure USE [xxxx] GO /****** ...
-4
votes
0answers
25 views

Not able to attach database backup file .bak into SQL Server 2008 [on hold]

I have a database backup file named iyym.bak. How can I attach the database to my SQL Server 2008? I tried inside SQL Server Management Studio the following: right click on data base folder in ...
-1
votes
1answer
30 views

sending email using database mail

How do I use database mail in SQL Server? I have followed many articles on the forums but I failed with many errors. I read in one book that I must have SMTP server and Microsoft Exchange installed ...
3
votes
0answers
39 views

MS SQL Server IO read increase appear randomly

The number of read (IOPS) in my MS SQL Server database increased randomly even during the night (low activities) from 0.3 MB/SEC (normal) to 25-30 MB/SEC. After like 30 minutes, it's capped to 6 ...
1
vote
1answer
24 views

Migrating DB, SSIS packages, SSRS Reports from 2008 R2 to 2012

I have been given the task of planning our BI department's infrastructure upgrade from SQL 2008 R2 to SQL 2012. This process will include updating our data warehouse (database), reporting ...
-4
votes
0answers
19 views

Update using SQL Stored Procedure [on hold]

I am new to SQL, I have 3 tables and I want to perform following logic via a stored procedure. IF Table A.Item No = MasterTable. Iteam No Then, Add a Record in table Short Expiry where Unique ID = ...
1
vote
2answers
41 views

Backup to local and MIRROR TO Azure Files returns ERROR

I have an Azure VM with SQL Server 2014, with a local drive (X:) for storing backups. Using Ola Hallengren's scripts. I added an Azure Files share and tried to do a mirror backup, but I get the ...
0
votes
0answers
13 views

SQL Server service in change pending state after trying to cycle service [on hold]

Database on an instance was stuck in recovery pending. Put database in emergency mode and then someone set it to be ONLINE which locked up the instance. If you try to use SSMS and browse databases ...
0
votes
0answers
11 views

Proper Partition Alignment SQL Server [migrated]

I'm trying to follow the advice from this technet article about partition alignment. Our San is an EMC, the disks are in a 4 disk raid 10. This is a SQL Server with an I/O intensive application, ...
0
votes
0answers
35 views

how to revoke backup and restore permission from database owner

I have SQL server 2008R2. I grant every user who wants to work on the database the database owner privileges, but recently found out that there is a database backup spam on the server, so I thought ...
0
votes
1answer
38 views

How to convert timestamp / rowversion to a date and time in SQL Server?

How to convert timestamp / rowversion to a date and time in SQL Server? I have several tables where I would like to track the last update, with column names like ModifiedAt, UpdatedAt, UpdatedDate. ...
-1
votes
2answers
50 views

SQL server avoid procedures parameter sniffing

I'm getting slow performances from this procedure CREATE PROCEDURE MyProcedure01 @date datetime2(7) AS BEGIN SELECT [Limit1].[C2] AS [C1], [Limit1].[mc_object] AS [mc_object], [Limit1].[C1] ...
-1
votes
0answers
19 views

complex SQL depending on each object insert time? [closed]

Hi so here is the table: Select * from LogTable order by insert_time desc LogTable: |user_id|action|object_id|insert_time| |2 |start |123 |20.04.2015 | |2 |stop |123 ...
2
votes
1answer
96 views

Use transaction logs multiple times

Every night a full backup is made of all the user databases. Every 15 minutes, transaction logs are created. Today i succesfully restored a database with the use of transaction logs. I set the time ...
0
votes
0answers
24 views

Query to List Backup Files on Azure Blob Storage

In SQL Server 2014, it is possible to restore a database from a backup stored on a URL: SQL Server Backup and Restore With Windows Azure Blob Storage RESTORE DATABASE [some_database] FROM URL = ...
2
votes
1answer
31 views

Advice on transaction log based reporting server

I am in need of advice on setting up a remote read-only MSSQL 2008 reporting server using transaction logs. From what I gather, true TLS setup requires both database servers to be aware of each other ...
0
votes
2answers
31 views

Whats SQL Server NVARCHAR(max) equivalent in MySQL?

Using SQL Server you just have to give the "MAX" parameter to the length of a text data type, but in MySQL there's no such a thing. According to Ispirer: "n" is the maximum number of characters, ...
0
votes
0answers
24 views

Why is the transaction log file not truncated though its simple recovery model? [duplicate]

My database is simple recovery model and when I view the free space in log file it shows 99%. Why doesn't my log file truncate the committed data automatically to free space in ldf file? When I shrink ...
1
vote
1answer
74 views

What is stored in a transaction log file?

What does the transaction log file store? Is it the blocks of transactions to be executed, is it the snapshot of records before beginning the execution of a transaction or is it just the statements ...
0
votes
0answers
22 views

What is the best Technical Advice to setup Microsoft SQL Server in an Entry Level Server with 2 SATA Disks? [closed]

SOS!!! What is the best Technical Advice to setup Microsoft SQL Server in an Entry Level HP ML310e G8 E3-1220V3 Server with 2x500GB SATA 7.2K Disks, 16GB RAM, Intel® Xeon® ...
0
votes
1answer
41 views

Limit the number of votes

I have a table of content. Users can vote on a content row. They can vote up to three times. I'm looking for the most efficient way to make sure they don't go over three votes. I can think of two ...
0
votes
0answers
11 views

How to Extract suffix from the table column names [closed]

I have 2 tables , 1 contains answers and columns are A1, A2, A3 so 3 in A3 means this is answer to the question 3. tblAnswers Personid A1 A2 A3 =============================== ...
0
votes
0answers
12 views

Distributed Replay DCOM issue

I have 2 SQL Servers in a Domain. Windows Firewall is disabled on both servers and there is no hardware firewall. Both servers are in the same subnet. One server, called Controller is configured as a ...
0
votes
2answers
69 views

When doing an update on a set of records, how do i get previous updates to show on current row to update in UDF [closed]

SO i have a rowset of 10 UIDs. They are all dupes, lets say DUPEUID. I have a UDF that will take the UID, check it against the table to see if there is a dupe, and update the UID to DUPEUID01. The ...
0
votes
0answers
56 views

sp_WhoIsActive is not displaying results

I'm trying to use the sp_WhoIsActive stored procedure that I've downloaded from here: http://sqlblog.com/files/folders/release/tags/who+is+active/default.aspx I'm running the procedure without ...
2
votes
1answer
39 views

Can't seem to understand why STUFF isn't working

I've got two tables that store questions and possible answers. The questions table can have multiple possible answers to it. I want to display the possible answers it can have per question.. For ...
2
votes
0answers
38 views

SQL Server 2005 Datawarehouse DB - Integrity failure caused by NonClustered indexes

Last year I've been working with a data warehouse database (SQL Server 2005) loaded on a daily basis during the nights. Overall database performance is acceptable. However, there is a "known error" ...
0
votes
1answer
42 views

Restoring SQL Server 2012 DB - OPEN SYMMETRIC KEY SKey DECRYPTION BY CERTIFICATE NAME Not working

Database Admins, can you please help me out and let me know why my script is not allowing me to DECRYPTBYKEY once I restore my DB from a PRODUCTION BACKUP.... -- SET Staging to Single User Mode to be ...
5
votes
1answer
192 views

How can we determine the SQL server version and edition from the available set up, before actually installing it?

We are going through the downgrade activity from SQL Server 2008 R2 Enterprise to Standard edition. To kick off the above activity we were looking for available standard edition of SQL server. We ...
1
vote
0answers
24 views

Best practices to segment people and attributes for advertising database

we have a database where we store people some attributes per person in the following tables: people (id, name, email, phone) people_attributes (id, person_id, attribute_name, attribute_value) ...
1
vote
1answer
28 views

How to define the logical name in a backup ? ( Sql Server 2008 )

I saw : This question but it didnt help me. In a simple way, Is there a way to do : Backup database SomeDatabase to disk ='c:\teste\SomeDatabase.bkp' configuring the Logical Name? Because we ...
0
votes
1answer
60 views

SQL Server: query for getting TOP X groups of records which have highest subsequent values

I'm querying each SQL Server DB CPU usage (based on query from here -- Get CPU utilization by database (Query 29) (CPU Usage by Database)) every 60 seconds and storing this information in dedicated ...
0
votes
0answers
15 views

Composite primary key in Multi-tenant sql server database

I'm building a multi-tenant app (Single database, single schema) using Asp Web Api, Entity Framework and Sql Server/Azure database. This app will be used by 1000-5000 customers. All the table will ...
0
votes
0answers
46 views

Why are transactions long running?

My stored procedure has a transaction blog. I pick up a record from a database and process it in that transaction block. I noticed that my transaction log has grown in gigabytes. But my transaction ...
0
votes
2answers
35 views

Can I recover a damaged SQL Server 2005 database with the undamaged .mdb and .ldf files?

We have a client who has suffered a power spike and it would be helpful to somehow reconnect with their SQL data. Their original SQL Server was 2005, with SP unknown, but installed on D: and C: ...
1
vote
0answers
73 views

SQL Script - SSMS Good, Job Bad

long time lurker and this is my first post. I have a SQL Server 2005 pro box running a handful of databases. I also have a few scripts I run once a week through SSMS to update data, so I thought I ...
0
votes
1answer
44 views

DB Permission: User can drop only their created db's?

I want to set permission against a user, which can create database and drop on their created databases neither any database. Any idea/suggestion ?
0
votes
2answers
79 views

How can I replace the following query with ISNULL function in SQL?

I have the following query. For performance optimization reasons I have been asked to replace the logic with ISNULL function in SQL. How can I achieve this? please advice. SELECT ...
0
votes
1answer
63 views

Enhanced ER Model Supertype / Subtype modeling issue with inheritance and recursion

Before posting, I have looked for a good solution on internet and I have coined this post for 3 days in row and trying to think through it prior this post. So if I have missed something or got it ...
0
votes
0answers
52 views

How can I replace the cursor in the below query?

I have this below query which calls a stored procedure that takes only 1 item's attributes at a time. But because of performance problems we are required to remove the cursor. How can I replace the ...
1
vote
1answer
32 views

In SQLCMD is there any way of shelling out to run arbitrary programs?

In the past I have dropped json into a table in a nvarchar(Max) column. This is structured data but it needed serving back to the client as json and came in from the client as json so it seemed a bit ...