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
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
52 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
99 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
53 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
65 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
90 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
93 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
117 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
111 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
53 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
88 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
76 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
32 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
68 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
16 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
56 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
105 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
35 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
57 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
52 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
62 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
47 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
29 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
34 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
99 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
71 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 ...
0
votes
1answer
253 views

Create and fill temp table

I have a stored procedure that selects some data and returns it. Now I also want to add a temp table, fill it with data and return it with the stored procedure. I define it as follows: create table ...
2
votes
1answer
56 views

MS SQL - export tables to format compatible with PostgreSQL

We're using MS SQL Server 2005 at work and I want to export our data to PostgreSQL for testing. MS SQL Server has an export function but the only one that looks like it would work would be to export ...
10
votes
1answer
301 views

Resolving deadlock from 2 tables only related through indexed view

I have a situation where I'm getting deadlocks, and I think I've narrowed down the culprits, but I'm not quite sure what I can do to fix it. This is on a production environment running SQL Server ...
2
votes
1answer
53 views

Set maximum cpu usage to a single job in SQL server

Is it possible to restrict cpu usage for a job in SQL Server? I found Resource Governor does work for an instance of mssql for a specific users group. However, I only need to set the maximum cpu ...
0
votes
1answer
62 views

Indexes and their uses [closed]

Index improve performance in select statement, but what is the difference between this create clustered index ix_index1 on table1(col1) create clustered index ix_index2 on table1(col2) and this ...
0
votes
0answers
31 views

Rebuilding an index not working? [duplicate]

I noticed that when I right click manually on an index and choose "Rebuild" or "Reorganize", its not giving any indication that its doing so, then I click on properties again for the same index, I see ...
2
votes
1answer
48 views

SQL Server many-to-many relationship, row reuse?

Below is your typical many-to-many relationship. Pretend there are 2 tasks that have the exact same Tags. because of foreign key/primary key relationship constraints, there is no way for the rows in ...
1
vote
2answers
61 views

How to remove a table partition

I would like to remove a partition from a table in a SQL Server 2012 database. The table has a primary key but the partition column is not a primary key. I would also like to keep the data structure ...
1
vote
1answer
34 views

How can I split Date column values in Access into 2 columns?

I have a date column that stores values for begining to end date as: 070314-073114 So I need to split it to 2 columns that has the Start Date as 070314 and End Date as 073114, any suggestions? This ...
0
votes
0answers
34 views

How to improve performance joining tables with no primary keys

Given two large tables of ~8,000,000 rows each. They are being joined on substrings of name address zipcode Naturally, the query is taking a long time. What are the best methods to improve it
3
votes
2answers
115 views

Deadlock with simple queries in sql server 2008

I have an application that must delete and insert registries from a table, the table is storing the historic registries for an access control and is stored with the datetime for the check in the ...
0
votes
2answers
81 views

When should I NOT set the Maximum Server Memory option in SQL Server?

In SQL Server, I normally set the Maximum Server Memory setting to one of the popular best practices, such as leaving 10% or 4GB, whichever is higher. ...
1
vote
2answers
31 views

SQL view, how to append results from tableB with the results from tableA

I am using SQL server 2012. I would like to generate a sql view where I got all records from tableA. And below these results I would like to have the results from tableB. There are no relations ...