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

Upgrade SQL Server 2000 engine

I have SQL Server in which I need to upgrade and restore a .bak file Server 1: Microsoft SQL Server 2000 - 8.00.194 (Intel X86) And by requirements I need it to match Server 2: Microsoft ...
1
vote
0answers
48 views

Database Structure Definiton

This is a question more so on the table definition vs actual programming. I have 6 sets of potentially 255 unique fields. I have a potential of getting 40 million records per year of these. For the ...
4
votes
2answers
183 views

Repair SQL Server Database [closed]

Can anyone give me a complete guide to verifying/repairing a SQL Server database? At the moment our backup is failing on the Solarwinds database saying the database NetPerfMon is corrupted (we are ...
7
votes
3answers
164 views

Optimize select on subquery with COALESCE(…)

I have a large view that I use from within an application. I think I've narrowed down my performance problem, but I'm unsure how to fix it. A simplified version of the view looks like this: SELECT ...
1
vote
1answer
65 views

Enforce referential integrity between two groups of data

I have two sets of records: A collection of rules. A collection of actions to perform based on those rules. What I'm trying to model is something like this: Multiple rules can be grouped ...
1
vote
2answers
52 views

Using UNION (ALL) in a WHILE loop with SELECTto merge the result set for each iteration

When I am looping with WHILE in SQL Server 2012, if I use a SELECT statement it prints the column name for each iteration. Can I UNION all? Here is my sample query: CREATE PROC spGetChar @start ...
0
votes
2answers
57 views

Get the first and last names of all employee who entered the project at the same time as at least one other employee

SELECT EmpFname ,EmpLname FROM Employee_m WHERE ( SELECT COUNT (w1.EnterDate) FROM WorksOn_m w1,WorksOn_m w2 WHERE w1.EnterDate = ...
0
votes
1answer
56 views

When to rebuild and when to reorganize indexes [duplicate]

I have been trying to gather information about rebuilding and reorganizing indexes. From stackoverflow page (How Often should the indexes be re-build in sql-server DB?) i got this query : SELECT ...
0
votes
2answers
42 views

Does leaving a connection open for a matter of seconds cause deadlocks?

I have been testing a system application and have noticed that it is slow when it connects to the database overseas. This is to be expected to some extent, but there is a big difference with the ...
0
votes
0answers
71 views

SQL Server Perfmon % Processor Time unbalanced [closed]

I am somewhat of an accidental DBA, and I'm troubleshooting a SQL Server box where performance has been notoriously poor (as reported by the customer). I was not involved in the initial planning of ...
1
vote
1answer
45 views

MS SQL Server 2012: once a day full replication (automatic backup/restore) for reporting

Our company is w/o a DBA, and it has fallen on me (a complete DB noob) to handle some critical database tasks. I'm looking for the best solution for us to be able to "copy" a full database to another ...
0
votes
0answers
32 views

Retrieve SPID For SSRS Request

Is it possible to determine what SPID was created to execute a SSRS report? I am trying to prevent users from running the same report multiple times. So what I was thinking of doing was retrieve the ...
2
votes
2answers
99 views

How I can force the TSQL-Developers to use not deprecated TSQL?

I want to avoid the using of deprecated code. Like the new feature Nr. 8 http://msdn.microsoft.com/en-us/library/ms178053.aspx I want to force them to use "WITH" for example, or a semicolon at the ...
3
votes
1answer
51 views

Adding warning with sp_add_alert doesn't work with “Greater Than” and SQL Server 2014

We upgraded our SQL Server from 2008 R2 to 2014. I want to add a custom warning. USE [msdb] GO EXEC msdb.dbo.sp_add_alert @name = N'MAN more than 1000', @enabled = 1, ...
1
vote
1answer
470 views

what is '#' in create table statement? [closed]

I recently saw a statement like: CREATE TABLE #tbl_AR_Data I wanted to know what is the purpose of the symbol # (NUMBER SIGN, hash, pound sign) in this statement?
0
votes
1answer
47 views

SQL Server 2008R2 Migration to new Platform - What Steps Required?

We are migrating our SQL Server 2008R2 instance from one Windows Server platform to another. SQL Server will remain as 2008R2. The new plaform will have more disk space, memory and CPU. I am doing up ...
1
vote
1answer
90 views

Two SQL Server databases setup with same .mdf and .ldf files

In a SQL Server 2008 R2 instance two databases (the second one being a restore/copy of the first one) have been setup against the same .mdf and .ldf files. How would I go about either deleting the ...
1
vote
1answer
49 views

Does SQL Server 2014 Express, with Advanced Services, actually support full text search?

I've installed SQL Server 2014 Express edition, with advanced services. I was hoping to try out the full-text search features. I read here that full text search is supported by the 2014 express ...
0
votes
2answers
62 views

Are these linked server queries susceptible to SQL injection?

I'm using a stored procedure to generate a create table script on the fly based on parameters passed into it. I am validating that the server exists, and then validating if the table exists in the ...
1
vote
1answer
82 views

Use NOLOCK hint when calling table valued function

Suppose the following function: CREATE FUNCTION [dbo].[ufnTest]() RETURNS TABLE AS RETURN SELECT 1 AS Nr My actual function will select actual data from many different tables. I (mostly) understand ...
1
vote
1answer
86 views

SQL Datetime / datetimeoffset(2) comparison & implicit cast wierdness

I discovered a problem when inserting data in our database. My insert statement was checking for the existence of data in the WHERE clause to prevent duplicate data being inserted. None was detected, ...
3
votes
3answers
107 views

Log File Management - Space on Disk

At our organisation we have several non-Production environments where Developers run free and wild with TSQL code and databases. The DBA team do not normally monitor or maintain them. Recently several ...
4
votes
2answers
110 views

Clustered Table Scan Because of “SELECT *”

I have a Records table with over 100 columns and very many rows, and a nonclustered index on 5 fields based on my access paths: CREATE NONCLUSTERED INDEX [IX_Records_CustomerID] ON [dbo].[Records] ( ...
0
votes
2answers
50 views

Transfer all tables from a schema to other schema

I have two schema. Schema1 and Schema2 How would I transfer all the tables from schema1 to schema2?
2
votes
4answers
51 views

Null Or Multiple Parameters When Querying

I have a stored procedure that has a parameter that must take a comma delimited varchar list of values that can be turned into a table of values or can be NULL, such as @Values VARCHAR(10) = NULL ...
2
votes
0answers
82 views

How do I give file system access to SQL Server's SQLSERVERAGENT virtual account?

I'm trying to grant the NT Service\SQLSERVERAGENT Windows account file system access, based on the marked answer in this question. I believe it's a virtual service account, and it does not show up in ...
3
votes
1answer
73 views

Sargable Queries

Very simple question I hope, I'm currently having some scripts I inherited into my project reviewed by the database admins. This has never been done before apparently and lots of issues are being ...
1
vote
0answers
30 views

Creating SQL Azure login for single database

I want to create separate logins for each database we create on a SQL Azure database server which only have read / edit permissions for a single database and do not have drop permissions, and to ...
2
votes
0answers
66 views

Slow query execution using ODBC 32

When executing a simple select query on a SQL Server 2012 system, the execution time is very different if I use OLE or ODBC 32bit. Unfortunately I am forced to use ODBC 32bit. The Query: SELECT ...
0
votes
1answer
15 views

Deploy SSRS 2012 report to a distant Sharepoint 2010 server

My installation : - SQL server 2008 r2 + Sharepoint server (main farm) = VM1 - SQL server 2012 + SSRS 2012 (not native mode) = VM2 I would like, if possible , make my SSRS configuration manager ...
0
votes
1answer
38 views

Sending one email when all jobs completes successfully

I need to create backup jobs over several instances, I wonder if there is any way to send a single notification via mail only when jobs from all instances completed successfully.
1
vote
1answer
51 views

How does MS SQL Server authenticate MSDTC connections when using SSPI?

I'm trying to get SSPI authentication to play well with two-phase transactions via MSDTC, using PostgreSQL with psqlODBC. I can't figure out how it can work securely - so I'm hoping someone can ...
0
votes
1answer
33 views

Print the execution time on messages Pane?

How I can print the execution time of each query on messages Pane? For example the Select * from tbl1 runs for 10 mins then Select * from tbl2 runs for 15mins and so on.. Select * from tbl1 Go Select ...
4
votes
3answers
103 views

What is the proper way to store a full table of data outside of a database? It needs to be able to be restored as well

I have a large SQL Server 2005 database that hasn't had the best maintenance over the years (I just took it over recently). There are around 100 tables that can be completely removed from the ...
-1
votes
1answer
34 views

Divide single column value into multiple column depending upon the bit value of another column [closed]

I have a table containing following fields. Id varchar(5), TranDate date, TranType bit, TranAmount decimal(15,3) My table looks like this: Id TranDate TranType TranAmount ...
1
vote
1answer
37 views

best possible index on this situation

create table #testing(id int, name varchar(50)) go Insert Into #testing Values(231, 'fasd') Insert Into #testing Values(232, 'dsffd') Insert Into #testing Values(233, 'xas') Insert Into #testing ...
0
votes
0answers
52 views

Why cannot login to restored SQL Server 2012 database?

As part of the effort for developing a Windows Service, I restored a production database to a test database on the same SQL Server instance, and can access the test database just fine via SSMS. I gave ...
0
votes
0answers
49 views

Uploaded files corrupted except txt/csv

I have an ASP.NET MVC 4 Application with standard CRUD functionality plus a file Upload capability. Currently I am struggling with the files being corrupted after the download. I created a ...
-3
votes
1answer
59 views

Select Top N rows for Employees in a SQL Server table

I would like to select the TOP 2 activities carried out by all employees from an Employees table "Emp" which has a timestamp column. The regular "Select Top 2 * from Emp...." will only fetch the top ...
1
vote
0answers
31 views

Self Service Portal for SQL Server [closed]

I'm searching for some Kind of Self Service Portal for SQL Server. Besides writing my own runbooks in Orchestrator - are there any good tools to empower the database owner to create backups, restore ...
1
vote
1answer
36 views

set date value based on other row values

Sorry for the Header, I can't find the right way to describe what I want, possibly the reason why I can't get a solution by googling :) ... Here my problem: I've got a table with the following ...
1
vote
1answer
29 views

ALTER TABLE … SWITCHing from regular table to partitioned table fails

The code below does the following: Creates a database play_partition in C:\TEMP Creates two identical partitioned tables play_table and archive_play_table Switches play_table partition 1 to ...
1
vote
1answer
43 views

Dealing with large transaction logs in a cluster

Disclaimer: I'm a dev, not a DBA. I've gleaned what I can from MSDN, but could do with some expert guidance! I'm working with a SharePoint 2013 installation on a SQL Server 2012 cluster of two DB ...
0
votes
0answers
36 views

Track record deltas/changes on SQL Server 2008

Trying to build some sort of ETL process that copies rows from SQL Server into Elasticsearch indexing server. My ETL process should be able: Detect new rows inserted to the SQL Server table. Detect ...
0
votes
1answer
20 views

SQL Server Merge Replication Change Partition Definition

I am using Merge Replication on a few SQL Server 2008 R2 servers. There is one server, and the rest are clients. I have each of the clients on a different partition using row filters with the ...
1
vote
1answer
72 views

SQL Server DIFFERENTIAL BACKUP question?

Simple question At what point is a differential backup considered transactionally consistent? Is it the creation date of the DIFF, or the time at which it completes? That is if I restore it what ...
0
votes
1answer
27 views

What are alternatives to Replication to distibute data (Microsoft SQL Server)

Is anyone knowledgeable of alternatives to SQL Server replication? I have a scenario where separate databases will share a lot of the same data which complex queries will match against. We want to ...
0
votes
1answer
31 views

change display of rows into single row in SQL server 2008 using dynamic PIVOTS

I have 2 tables - USE [Test1July] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Hotels]( [SeqID] [int] IDENTITY(1,1) NOT NULL, [HotelName] [nchar](25) NULL, ...
0
votes
2answers
92 views

Problems during installation with Database Engine Service

Overall summary: Final result: Failed: see details below Exit code (Decimal): -2061893606 Start time: 2014-07-04 13:40:51 End time: ...
0
votes
1answer
63 views

Fastest way to migrate database to AlwaysOn cluster

I want to make the fastest migration plan to move a SQL Server database in simple recovery from a standalone server (SQL 2005) to a two node AlwaysOn cluster in full recovery. Some databases are ...