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)

1
vote
2answers
75 views

I have a year's worth of inventory data, and I want to extract the first and last day of each month's data. What is the best way to do this? Thanks

I have a year's worth of inventory data, and I want to extract the first and last day of each month's data. What is the best way to do this?
1
vote
1answer
23 views

SQL Server AS: Set ImpersonationMode via PS

Try to create a database in SQL Server Analysis Server (SQLAS, SSAS) version 2012 SP2 if that matters and set Impersonation Mode via Powershell. (try to avoid XMLA script). Here are my attempts. Does ...
7
votes
3answers
415 views

Accidentally change database name (SQL Server 2008)

It didn't happen to me YET. But I was thinking about this. I was messing around with my training environment, and by mistake I clicked in the database name, and then I touched the letter A. Let's ...
5
votes
0answers
111 views

Identical query slower when searching for `T` rather than `F`

I have a legacy database that uses char(1) with 'T' and 'F' for boolean values. The only values in the field are T and F, of the following queries, the first is instantaneous, the second takes 30 ...
1
vote
2answers
36 views

Move a Filestream column between tables

I have a table which has a Filestream column which I would like to move to another table. Is this possible without having to do a "manual" move of the data (create target column; issue UPDATE/INSERT ...
1
vote
5answers
69 views

TSQL insert table using view — performance issue

I have a big view joining multiple tables that in a regular basis materialists itself into a table (this step occurs for viz's tool read a table instead of a view during data source refresh): select ...
1
vote
2answers
29 views

Adding second SQL Server to create 2 Node cluster

I am not a dba. I have general knowledge of SQL Server and T-SQL. Our company currently has a SQL Server 2008 R2 hosting about 30 databases. I've been asked to research adding a second server for ...
4
votes
3answers
159 views

Compare 4 or more columns values

I have a table like: ID A0 A1 A2 A3 A4 14 A B A C A 15 A A A A A I need to compare all 5 columns and check if they have same value and retrive the only one that have all same ...
1
vote
1answer
16 views

Order of DROP_EXISTING and ONLINE for CREATE INDEX

If I call a CREATE NONCLUSTERED INDEX using DROP_EXISTING = ON and ONLINE = ON what order are things done it? What I want is: New index is made in the TempDB Existing Index is dropped New index ...
7
votes
3answers
134 views

IF statement not skipping TempDB when Looping through Databases with sp_MSForEachDB

[SQL Server 2012 SP2 EE] Why does the following script gives me an error relating to tempdb? exec sp_MSForEachDB ' IF ( (select database_id from sys.databases where name = ''?'') > 4) ...
5
votes
1answer
44 views

Adding PRIMARY KEY and IDENTITY attributes to SQL Server 2008 tables

An application is using an SQL Server 2008 database that has ID columns, but these columns are not primary keys and have no IDENTITY attribute. What I need to do now is adding the PKs and IDENTITY ...
9
votes
3answers
290 views

Backup internals - What happens when a backup job is running - in terms of locking and performance overhead in SQL Server?

For MySQL I know the database is backed up table by table in SQL Statements, this results in locking and if you update columns while backing up you might end up in integrity problems. To my ...
1
vote
2answers
38 views

Looking for application which will provide to determine project database growth and cost per day or month

I am using SQL Server 2008 for product development Currently application is live with 20 users now if I want to check how my database is growing and how much it will grow in month or year projection ...
2
votes
1answer
16 views

Failure notification with multiple profiles

In my SQL Server Agent having several jobs which are running with different Proxies... and in Database mail having more than one profile [each profile having individual accounts]... now my question is ...
2
votes
0answers
26 views

OPENQUERY and server permissions

when I run my stored procedure it is a complete success, even if I run it through exec. Running these: sp_GetServerLogins GO exec ( 'sp_GetServerLogins ') GO I get this: Needless ...
2
votes
1answer
58 views

Improve performance on SQL Server Query

I'm trying to increase the performance of a query and I'm out of ideas: The query does this: gets a 'Process' with specific priorities on selection namely: Picks up a process that has been waiting ...
0
votes
1answer
28 views

Nullable Fields to Separate Table?

My website has a form page that has radio buttons yes|no corresponding to 7 questions. When the user selects yes, the user needs to specify a value (either a location, name, or medical condition, ...
0
votes
0answers
14 views

Passing DataTable using SqlBulkCopy

Should I convert the DataType of DataColumns in to pass DataTable using SqlBulkCopy? This are the fields in my sql server database
2
votes
2answers
73 views

SQL Server 2008 - combined index + other separate index on one column

Lately I've been refactoring the SQL Server indexes of the products that I have developed for my employer. One of these products is an online dashboard containing multiple user levels. Each user (on ...
1
vote
1answer
20 views

inserting the table colomn data in multiple tables colomn.(SQL SERVER) [closed]

I want to insert one table colomn data into multiple tables colomns using triggers. For Example: I have one table name 'T1' having multiple colomns like 'C1','C2','C3' and now I want to insert these ...
0
votes
0answers
70 views

Need your help in query tuning

I read ​one article which shows how to use different aggregations effectively. http://sqlblog.com/blogs/paul_white/archive/2011/12/04/is-distinct-aggregation-still-considered-harmful.aspx I am ...
1
vote
2answers
33 views

SQL Server : CRUD Editor that will track data changes [closed]

I'm looking for a tool that allows CRUD changes to SQL Server data. Our company currently utilizes a product from Pro Data called DBU (database utility) to make IBM DB2 / AS400 changes. This tool ...
6
votes
2answers
175 views

SQL Server Management studio slow connection or timeout when using Windows Authentication

I'm getting extremely long delays (10~30 seconds) in SQL Server Management Studio 2014 when attempting to connect to a SQL Server 2012 instance over TCP using Windows Authentication. This happens when ...
0
votes
0answers
42 views

Getting “invalid authorization specification” when creating linked server

I have two databases. Database A is on DBServer\Instance1 and Database B is on DBServer\Instance2. I need to create a view inside Database B that looks into a table in Database A. I was told I need to ...
6
votes
2answers
77 views

Why does a Columnstore index build often wait on SLEEP_TASK?

I'm building a Columnstore index right now. The output from sp_whoisactive: This is a dev machine. Nothing else is running. The server has 8GB of memory available to it. The CPU is nearly idle. The ...
0
votes
0answers
24 views

How to copy all database users from one database to another? - SQL Server 2008 R2

I am making a database from a backup file (I'll call this db 1) and I need to duplicate the users of one database (and this db 2) to the newly restored database. The first step I know must be done is ...
8
votes
0answers
82 views

SQL Server 2014 schema changes in 24/7 multi user environment

We have SQL Server 2014 Enterprise installed to run a database which should be available 24/7. Our database is huge enough (200gb +). Also we have a lot of services that hits our database every minute ...
1
vote
3answers
56 views

Can't connect to remote SQL server from some machines

Our web server uses SQL Server 2008 R2. I have one development machine that connects to it with the IP address through SSMS and when testing my aspx website. I have several other machines though that ...
-1
votes
0answers
31 views

Unexpected update/delete on OLTP database in SQL server 2005

We are facing one of the major issue where one of the table on a heavily used OLTP database seems to have updated the records which were not expected the way it works for past 3 years or were ...
0
votes
1answer
49 views

SQL Server : query code

I am trying to write a T-SQL query for SQL Server to pull some information from all the databases. I will then run this nightly and email the report to who it needs to go to. I have two separate ...
1
vote
0answers
23 views

Linked Server vs. Ad Hoc (OpenRowset / OpenDatasource) Distributed Queries

I have an application which needs to grab data from different clients' databases that reside at the client's location. So alongside their normal details such as company name, address etc, I also store ...
0
votes
1answer
26 views

Log debug messages in a SQL CLR C# Stored Procedure

I have developed a SQL CLR stored procedure in C#, for SQL Server 2012. I want to log messages to SQL Server registers. On a normal stored procedure I use xp_logevent What can I use to log a message ...
2
votes
1answer
23 views

Problems with sqlcmd -q and quotations marks

I have a SQL Server 2008 R2 Express edition. Because it is only an Express edition I don't have a SQL Server Agent for automation of tasks. So I tried to do something with command line program ...
0
votes
1answer
25 views

SQL Server Replication - FTP Snapshot: Policy requires SSL

SQL Server 2014 on both Publisher & Subscriber. Publisher & Subscriber are across the internet. Replication is Transactional Replication Error messages: The process could not connect to ...
0
votes
1answer
25 views

Sql Server thinks I have different Data Compression when swaping partitions

I am setting partition switching for my database. I created a script using SqlCmd variable so that the same script would make both my source and target tables for partition swapping. Here is an ...
1
vote
0answers
42 views

Preferred third party SQL Server backup tool? [closed]

Can anyone list their preferred third party SQL Server (with SQL Server 2012 support) tool? My organization is considering utilizing a third party tool to gain some speed and flexibility for our ...
2
votes
1answer
56 views

SQL Server 2008 R2 DB grows overnight and slow

I am running a SQL Server 2008 R2 SP2 DB. I have a DB that was running around 19 GB in size and three days ago grew to 34 for no good reason. We typically have about 100 MB growth in the DB every ...
1
vote
1answer
43 views

Combine multiple records into one, using name from only one record

I've got a query that returns a table of technicians and the number of work orders they've filled. The problem is that sometimes technicians get entered using their full name, and sometimes they get ...
1
vote
0answers
26 views

LinqToSql query is having intermittent problems

We have a simple, single table, LinqToSql query running against a SQL Server 2008 database. Every so often the query locks up and stops performing. Clearing the execution plans for the table is the ...
1
vote
1answer
36 views

Sql Server Database Books [closed]

I was wondering how I would go about learning the functionality of all the different store procs and functions that come out of the box with sql server. Would I be right in saying that a book on sql ...
4
votes
2answers
65 views

Rebinding a SQL Server user to its login after a restore with this user

After performing a restore of a SQL Server (v12.0.2000) database, I figured that a user needs to be remapped to its login (this issue seems to be known as orphan users). And one of the simplest way to ...
0
votes
1answer
20 views

Access 2010 ODBC Connection to SQL Server 2005

I'm trying to code an ODBC connection to SQL Server in Access 2010 and hoping someone can help me, as I've lost the plot. This is my code, it simply accesses one SQL Server database/table and insert ...
0
votes
0answers
25 views

Query Performance BIT column vs New Table

Would it be more efficient to flag 50 rows with BIT 1 / 0 in a table with 2000 rows OR create a new table to hold only 50 PK values from the previous table The query on this would just be a WHERE ...
2
votes
0answers
51 views

Why does SQL Server 2005 only use an IS lock in this scenario?

I am attempting to examine the locking behind different queries but with the same output to avoid deadlocking situations. I have the following code: SELECT MIN(ID), TextData FROM PKKEYTESTER ...
0
votes
1answer
26 views

DB_OWNER permissions for user [duplicate]

I would like to know if db_owner can change the recovery model of database. Using TSQL- alter database db set recovery simple
3
votes
2answers
41 views

Prevent logins loss when restoring a database

I'm backuping and restoring databases accross two sql server (v12.0.2000). But it looks like whenever I restore a .bak file, the login I created on the database that was backuped is no more existent ...
8
votes
3answers
182 views

Configure RAM for SQL Server and NUMA

Accidental DB admin here. Question: Would you still manually limit max RAM for SQL Server even though the sole purpose of that server is to serve SQL Server database engine only? I have Microsoft ...
1
vote
1answer
32 views

Efficient table structure for application logging

Am using SQL Server as my RDBMS and i want to maintain some transaction of an auto run tool which will log some info on a daily basis. I need some suggestions how an efficient structure to be. I mean ...
1
vote
1answer
25 views

Indexed view doesn't exist on the subscriber

I am configuring transactional replication in SQL Server. The subscription is configured as push from 2008R2 publisher (distributor is the same server) to 2012 subscriber. The object I want to ...
0
votes
1answer
33 views

SQLcmd error 'Failed to initialize sqlcmd library with error number -2147467259'

I'm trying to update some maintenance plans to make use of the Ola Hallengrens IndexOptimize, but also mail the result of the operation using sp_send_dbmail. Old T-SQL: declare @indexQuery ...