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

Grouping rows by looking at two columns without considering the order

I have a table looks like this one below: +----+---------+---------+ | ID | VALUE 1 | VALUE 2 | +----+---------+---------+ | 01 | A | B | | 01 | B | A | | 02 | C | D ...
3
votes
2answers
459 views

Configure Email to be sent on restoring a database

Is there a way to configure Email in SQL Server such that an Email is sent when a particular database is restored.
0
votes
1answer
158 views

Can I design this database better? [closed]

I have the following database design: Script to reproduce: /* DROP TABLE [dbo].[feedback] DROP TABLE [dbo].[action] DROP TABLE [dbo].[download] DROP TABLE [dbo].[user] DROP ...
1
vote
1answer
338 views

Simple update query balloons tempdb

I am trying to do a bulk update of a column from a csv file, however when I do the actual update operation my tempdb balloons to over 20 GB in size (overtaking the entire size of the SSD the tempdb is ...
1
vote
3answers
165 views

One or several tables for attributes

I just spent some time discussing two alternative DB designs with a coworker and I'm not convinced. Neither of us is strictly DBA so we may be missing something. The overall goal is to create the ...
1
vote
1answer
433 views

Optimising a query of an SSRS dataset

Consider the query given below: SELECT * FROM ((SELECT c.cust_id , c.username , REPLACE(qs.seg_type_ref_key_02, 'N/A', 'Non Vip') casino_group, ...
1
vote
0answers
171 views

Way to make differential backup from full different but from same database

I have the following situation: Our sql server is running in a cloud service. The database to be backed up have 60gb. We need to make a local copy of the database for some tests, and it need to be up ...
0
votes
1answer
281 views

DELETE query against a linked server issues error

I have a query that is part of a bigger process, and runs against a linked server. The code is like this: DELETE FROM [LinkServerIP].[Database].[dbo].[TableName] WHERE NOT EXISTS ( SELECT * ...
1
vote
1answer
1k views

Imitate 'dynamic' columns in SQL Server

We have a central SQL Server 2012 database. There is a single table [tbl_Users] that stores all kinds of information pertinent to an employee, for example, UserID CustomerID FirstName Surname ...
1
vote
1answer
628 views

Check for column in backupset table

Created a script to show last backup locations, sizes and dates SELECT DatabaseName = x.database_name, LastBackupDate = x.backup_finish_date, BackupSizeKB = x.backup_size, ...
0
votes
1answer
133 views

How do I setup a foreign key relationship based on two columns?

I have the following two tables: CREATE TABLE [dbo].[company] ( [CompanyID] [int] NOT NULL , [CompanyName] [varchar](150) NULL , [DepartmentID] [int] NOT NULL , ...
7
votes
4answers
524 views

Are there any problems with deploying an SQL Server database to a production server by taking a backup?

This is a slightly loaded question in that I have already assumed that the described scenario is wrong. A DBA is deploying an application I have written that includes an MS SQL Server 2008 database. ...
6
votes
2answers
4k views

When to make changes to the cost threshold for parallelism

While examining a performance issue , I have seen an influx on CXPACKETS suggesting I might need to look at the cost threshold for parallelism and perhaps the MAXDOP. Before making any drastic ...
1
vote
1answer
166 views

Data center from scratch which way to go

My budget for a data center (hardware,OS licences, SQL Licences WithOut CALS ) is around $50K~$60K. I have needs for around 200 users and my apps works only works in Microsoft environment (Window ...
3
votes
3answers
5k views

How to turn off identity for a database column of a table

I have mistakenly deleted a table in one one my database server. I have same set of data in the other server. What I have done is clicked on edit top 100 rows for the table, then copied it and pasted ...
4
votes
4answers
5k views

How to find unused indexes?

I am working on a Data warehouse. I have tables with up to 200M records. Some of these tables have around 20+ indexes (I can't provide a reason why they have been created in the first place). This is ...
5
votes
2answers
2k views

Restore Database SQL Server 2012

I'm a newbie when it comes to SQL Server, it would be helpful if someone could point me in the right direction. We have a database file that is called main-db.bak. This is the database file that we ...
4
votes
4answers
2k views

best ETL design to transfer transaction tables records into the data-warehouse

I have 2 type of tables to populate the data-warehouse with every day, lookup tables or configuration tables with few 100s records, and thats easy where i just truncate and refill the table. but for ...
1
vote
2answers
246 views

sql server-mirroring 3 sql server

we are developing an application for a company and this company has 3 branches, we design a SQL server for our application we can put this server in one of the branches but as the connection between ...
5
votes
2answers
517 views

How to determine when to reduce physical memory for SQL Server?

If I repeatedly notice SQL Server reporting a lot of free memory, can I likely remove about that amount of memory from the server without affecting performance? Or, can/should it use more for caching? ...
3
votes
1answer
266 views

Combine - Select Into, with Insert Into Select

I've read many explainations like this one here that say "Select Into ..." is to create new tables and "Insert Into ..." is to append to existing tables. I'm automating a coworker's sql scripts. ...
6
votes
2answers
525 views

Two Different Sources Taking Transaction Log Backups

I have inherited a database server with SQL Server 2005. The databases have full recovery mode with hourly transaction log backups. There are two sources taking full backups overnight and hourly ...
0
votes
1answer
38 views

migration sql 2003 to 2008, Sql side and php side [closed]

I have a system in php using MSSQL 2003. I need to change the database to MMSQL 2008. I want to know if there's issue I should look at on SQL Side (Query/SP/....) PHP Side (Query, connection type, ...
1
vote
2answers
116 views

Information on a Database that was restored with NO RECOVERY

I'm working with SQL Server 2008Sp3. I have a database that was restored from a full backup WITH NO RECOVERY and it then was restored with Transaction log backup files - also WITH NO RECOVERY. At ...
2
votes
1answer
3k views

SQL Server select with regex

Can we use regular expression to select the item from database? The table item is like below Table column|name| 10.01.02 | a | 100.2.03 | b | 1021.10.04 | c | Now my problem is that i ...
18
votes
2answers
8k views

Does a re-index update statistics?

I've been doing the MS10775A course this past week and one question that came up that the trainer couldn't answer reliably is: Does a re-index update the statistics? We found discussions online ...
0
votes
2answers
320 views

Access denied when disabling agent job, despite SqlAgentOperator membership

I am attempting to disable a SQL agent job from an account which a member of the SqlAgentOperator role (but not sysadmin) The doco says this should be possible 3 SQLAgentOperatorRole members can ...
2
votes
1answer
348 views

Getting the most out of SQL Server with a million rows a day [closed]

I have a windows service that is inserting 1000 rows at 1 minute intervals to a SQL Server 2008 Standard database table that looks like: id, datetime, key_id, value key_id is a foreign key to ...
0
votes
1answer
262 views

SQL Server hangs on a specific record

For some reason my database is hanging on a specific record: SELECT id FROM Foo WHERE id = 40469; Executes right away: SQL Server Execution Times: CPU time = 0 ms, elapsed time = 0 ms. ...
0
votes
1answer
418 views

Why would running a SQL query overnight break my database for the following day?

I apologise in advance if this is a duplicate question (which I bet it will be). I had a good search through and found similar questions but nothing that seemed an exact match. I wrote a report that ...
1
vote
1answer
409 views

Slow query and Insert with trigger

I have vehicle tracking system application based on PHP, SQL Server 2008 R2 Enterprise Edition with XEON HP Z800 Server. My database is growing day by day in millions and it makes it very slow to ...
4
votes
2answers
2k views

SQL Server tail log backup fails where it shouldn't

I am trying to set up a demo of backing up the tail of the log in case of disk failure, but it doesn't work as expected. The setup: Set AdventureWorks backup model to "Full", create a full, a ...
4
votes
0answers
405 views

Did the Change Tracking internals change from SQL Server 2008 to 2012?

In trouble shooting an issue with synchronizing disconnected devices with a central database server, we are experiencing a problem after upgrading to SQL Server 2012 on the server. It appears that the ...
1
vote
1answer
74 views

User mapping problem during deployment

I have a development machine with a new database I have designed. The server has a login L1 and the database has a user U1. L1 is mapped to M1 and tables have permissions set up for U1. Authentication ...
4
votes
2answers
9k views

How to break SQL script execution

I am working on sql script and I am having a requirement of stop continuing the script if some conditions are not satisfied. When I Google it, I found the RaisError with 20 severity level will ...
2
votes
2answers
420 views

SQL Server 2008 R2 : A Possible indexing strategy for the given schema?

We have these four tables: Store ( row bigint, id uniqueidentifier, name varchar ) Products ( row bigint, id uniqueidentifier, storeID uniqueidentifier, productname ...
0
votes
2answers
2k views

What is the difference between Completion and Success in SQL Server Maintenance Plans?

Using SQL Server 2008/R2 Maintenance Plans to setup some automated backups/cleanups and notifications. One thing that I can't figure out is what is the difference between Success and Completion? The ...
1
vote
0answers
193 views

How to check what stats were used in query

respected DBAs . . . is it possible to tell when statistics were last accessed by a query using T-SQL? I'm trying to ascertain what statistics are involved in a query, I know I can check the visual ...
1
vote
2answers
137 views

Why doesn't running a full sample *always* improve query performance

Conventional wisdom would suggest that running a full sample of statistics would provide SQL with the optimum information to make the best decisions when forming a query plan for execution and ...
0
votes
1answer
206 views

SQL Server Database Design for Reporting

We are designing a reporting solution for survey results. Although datasets are reasonable in size (rarely more than 500.000 respondents and 50 questions), performance is obviously a major concern. ...
3
votes
1answer
3k views

Is there a difference between granting SELECT a user and adding them to the db_datareader role?

I was asked to grant SELECT, INSERT and UPDATE to a given user for all tables in a database. I ended up adding the user to db_datareader and granting them INSERT and UPDATE at the database level. ...
1
vote
2answers
426 views

Constant values in columns

I have a SQL Server 2000 database used by our ERP system. There are many columns that always have the same value. A table row is really huge, potentially exceeding the maximum row size in SQL Server ...
1
vote
0answers
457 views

How to shut down clustered SQL Server 2008 R2 with NOWAIT?

Is it possible to shutdown with nowait on a clustered instance? I want to delay recovery to when the instance starts, and I want to shut down as quickly as possible without issuing checkpoints to my ...
3
votes
2answers
448 views

Efficiently query MAX over multiple ranges

When performing a MIN() or MAX() over a single range covered by an appropriately sorted index, SQL Server does a TOP() and so returns the value after fetching just one row. When the search criteria ...
3
votes
1answer
694 views

Dynamic file name for file import

I'm trying to figure out a way that I can pass a filename into a stored procedure that can import a file. However, after setting up the SQL dynamically, the object can't be found. DECLARE @fileName ...
2
votes
1answer
2k views

varbinary to varchar or nvarchar

When retrieving a text value, which has been stored in a varbinary field, and converting back to text, is there a way to determine whether it was stored as a VARCHAR or NVARCHAR string? If it is ...
1
vote
1answer
2k views

How to setup SSL in SQL Server 2012 with own certificate?

Environment: Windows 7 Professional x64 in a domain, running SQL Server 2012. I have local admin rights, so messing up the system is easy. My SQL Server instances are SQLEXPRESS and MSSQLSERVER. FQDN ...
0
votes
0answers
58 views

Why should be Mysql considered over Mssql in a live working scenario? [closed]

Why should be Mysql considered over Mssql in a live working scenario? I am working in a private software company and i am a fresher and i have been instructed to move from Mssql to Mysql. But i ...
7
votes
2answers
6k views

What steps are necessary to safely restart a machine hosting Microsoft SQL Server?

Are there any special steps necessary to prevent data corruption when restarting a server hosting an MS SQL instance? For example, I recently encountered the recommendation of stopping the SQL ...
1
vote
1answer
223 views

Stored procedure to validate xml content against dtd

I have a stored procedure which creates xml content and then is stored to a xml file. Is it possible to validate the generated xml content against a dtd file? Thank you in advance!