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
2answers
632 views

Database log unavailable

I am using SQL Server 2005 and I see the following message in event log (event id 9001) "The log for database xxxx is not available." After doing some research I found that it could be a corrupted ...
10
votes
2answers
434 views

@table_variable or #temp_table

I have a big user defined table type variable that has 129 columns. I will store around 2000-3000 records in this table variable at a time and pass it to various stored procedures and functions to get ...
14
votes
3answers
5k views

Schema design - best practices?

I understand the capabilities of SQL Server Schemas, but what are the best practices? Sure they give another layer of security, and provide logical grouping of database objects within the database, ...
2
votes
1answer
996 views

Can't retrieve data of countries and regions

Goal: Improve my sql ability by doing some coding and reviewing existing code. Problem: I have spent lots of hour to find a solution based of this question "3c. Some countries have populations more ...
1
vote
1answer
779 views

Can IMPLICIT_TRANSACTIONS set on database level?

When I have to investigate problems caused by IMPLICIT_TRANSACTIONS ON, can I focus on Client tools setting IMPLICIT_TRANSACTIONS ON or ANSI_DEFAULTS ON or can this be set for the whole database ...
4
votes
2answers
7k views

How to export a single huge table from SQL Server?

I'm given the task to export the content of a huge table from a production database and to import the data into a database at a remote location. The Table has about 45,000,000 rows. using about 4 GB ...
2
votes
2answers
247 views

Creating a new role

How do I create a new role in my database with my first name which is Denise, and add read only access on the HR user's EMPLOYEES table to this role.
14
votes
4answers
59k views

Can I see Historical Queries run on a SQL Server database?

Someone was running a query on our SQL Server database remotely and their system crashed. They have no backup of that query and want to see what was run on the server. Is it possible to find this ...
6
votes
1answer
638 views

The use of NOT logic in relation to indexes

According to Microsoft's book on database development Exam 70-433: Microsoft SQL Server 2008 Database Development: Neither leading wildcard characters not NOT logic allow the query optimizer to ...
14
votes
1answer
427 views

Does anyone have a good recommendation for a book which teaches sharding?

Does anyone have a good recommendation for a book which teaches db sharding (from scratch at best) I have read like 40 different websites talking about sharding. I'm not saying online sites/blogs ...
8
votes
3answers
2k views

What are the alternatives for an ORDER BY clause in a View?

This question just had to be in this site :) ORDER BY is forbidden to use in a view, as I understood because of the possibility for multiple order by's when using this view. I know that there are ...
12
votes
3answers
4k views

Is it possible to backup and restore part of a database in sql-server?

We have a sql-server 2005 database that we regularly transfer from our client site to ours. This takes a long time because we don't have a direct connection and have to transfer the file over their ...
3
votes
4answers
2k views

Should I convert empty varchar values to NULL?

I have a stored procedure which accepts various varchar parameters. The middle tier code which calls the procedure has not been consistent in terms of the values it submits. For example, sometimes a ...
3
votes
2answers
11k views

SQL query that concatenate values from duplicate rows in a single table

Lets say I have a table of employees, like this: Name Sex Role Bob M Developer Joe M QA Now, I have a problem with this table of duplicated rows. I will fix it ...
5
votes
1answer
2k views

Send email when certain Data is being inserted in MS SQL Server

I realize that there is an integrated email notification system in SQLServer, where I can configure it to send an email using my organization's Exchange server. I want to use that to send email on ...
5
votes
1answer
60 views

SQL Server 2008 Index

What would be the best index(es) to add to the tables in order to make this query as fast as possible. The sd.incidents tables is about 2.5M records, problems about 8K, and changes about 120K. select ...
6
votes
1answer
769 views

Guarantee SQL Server Identity Columns that two consecutive values differ by constant increments?

I posed a question about Denali sequences here and another question about emulation of identity columns in Oracle Global Tables here. I always thought that I could trust that identity values ...
2
votes
4answers
4k views

SQL Server: cold backup, shutting down services?

One of our collagues told me that they are doing "cold" backups for SQL Server so that they are shutting down services and then taking a backup somehow. I think this is all wrong! Am I right? I think ...
1
vote
2answers
137 views

Determine free space on “nonfixed” drive

I am writing a stored procedure that needs to send an email when a dvd rw drive is almost full. I found master.sys.xp_fixeddrives but it only shows free disk space for fixed hard drives. I have not ...
4
votes
4answers
5k views

How SQL Server handles concurrent requests?

Suppose a SQL Server table has two MailID columns, with max value = 5. If two different users at the same time execute insert queries that try to insert Max(MailId)+1 into the MailID column, is it ...
1
vote
3answers
949 views

Is it possible to install a MS SQL Express Studio, where the studio tool also is included?

I am facing the following problem: I want to have a Express (=free) version of MS SQL Server and there I want to be able to see the SQL Management Studio interface. I have found only installations ...
6
votes
1answer
8k views

Add DEFAULT to existing column

In Microsoft SQL server, how can I add/change the default on an existing table column using T-SQL?
4
votes
3answers
976 views

Is there a collation to sort the following strings in the following order 1,2,3,6,10,10A,10B,11?

I have a database with a VARCHAR column that contains integers of varying length. I want to sort them so 10 comes after 9, not 1, and 70A comes after 70. I was able do this with PATINDEX(), a CTE, and ...
2
votes
2answers
2k views

SQL statement to combine main table and child table as columns?

Having a main table and a child table in a Microsoft SQL Server database (2005+), I want to show the user a single table in a grid view which includes rows from the main table and rows from the child ...
0
votes
1answer
322 views

How to configure MS SQL log on so that it can be used by another program?

Problem on MS SQL Server Background: I am about to install an application that asks already in the installation phase about MS SQL database to create its DB inside it. There are options of Windows ...
1
vote
2answers
5k views

Send Email when sql server agent job fails

How can I send an e-mail when the sql server job fails. I added my e-mail as operator and then in the job properties -> notification -> enabled the email. But it is not working. Any ideas?
1
vote
1answer
111 views

Using different servers for front-end and back-end?

I recently noticed that the load time of my website has slowed significantly. I'm not a developer, but my programmer mentioned this is due to the large amount of data that is being searched through ...
14
votes
3answers
11k views

How does shrinking a SQL Server log file affect performance?

I have a SQL Server 2008 database that has a data file of some 2GB in size, but the log file is over 8GB. With pre-2008 databases I could use the 'Backup log' and the TRUNCATE_ONLY option but this is ...
2
votes
1answer
445 views

SQL Server Logon Trigger causing problems with the Distributed Transaction Coordinator

I've created the following simple logon trigger on my SQL Server 2005: CREATE TRIGGER LOGON_RESTRICTION ON ALL SERVER FOR LOGON AS BEGIN PRINT 'Hello World' END GO Which seems to be working fine ...
8
votes
5answers
9k views

Pros/Cons Using multiple databases vs using single database

Working on a new project which has the requirement to use 7 databases. Arguing performance, stability, optimization is easier implemented. While I don't agree I'm having trouble collecting good ...
3
votes
1answer
86 views

How do you move a Database from one server to the other using MS-SQL-SMS

I need to move a database, but I want to make sure I do it safely and with all triggers, store proc and functions. I was think to simply detach the database from my server using MS-SQL-SMS and move ...
3
votes
3answers
865 views

Does this computed CHECKSUM() index design make sense?

I have come across what looks to me like a slightly odd pattern in a SQL Server 2005 database I'm taking care of, and was wondering whether it's just me, or whether it really is odd. There are a ...
1
vote
2answers
2k views

Distributed Transactions between SQL Server 2000 & MySQL Stopped Working

We have been successfully copying data from a MySQL Slave database into a SQL Server 2000 database. The MySQL server is a linked server. I have tried using v3.51 and v5.1.8 of the ODBC connector ...
2
votes
1answer
211 views

Query table A for any rows that are like any search term in table B

I need some help writing a select statement (I still don't think in sets!). Here's the scenario: I have table A with column "Name varchar(20)". I have table B with column "SearchTerm varchar(20)". I ...
8
votes
2answers
4k views

SQLCMD Mode in SSMS and @@variable expansion

When using the SQLCMD mode withing SSMS (not from the commandline), is there a way to assign the current server and instance to a variable? This is different and distinct from assigning ordinary TSQL ...
6
votes
1answer
1k views

Why "Select * into targettable from sourcetable “ is faster than “insert into targettable select * from sourcetable

This title is the question. I am curious to know the answer. Someone told select into is minimally logged in Simple recovery model database ... I didn't get into it at all. Excerpt from Microsoft: ...
1
vote
1answer
759 views

Is it possible to make schema changes on a replicated subscriber database?

I have a table that is published via transactional replication. A developer has requested modifying the subscribed table to add a column that is to be used for reporting purposes. The column will be ...
8
votes
9answers
2k views

Which DBMS are fast enough for an online game (few thousand players)?

I'm currently making an MMORPG game, which could have a few thousand players online at the same time (probably not; just wishful thinking). First we wanted to use MySQL, but I have heard it isn't fast ...
6
votes
3answers
9k views

Why is a .bak so much smaller than the database it's a backup of?

I just took a backup of a SQL Server database. The MDF and LDF files together total around 29 GB, but the .bak file was only 23 GB, about 20% smaller. My first guess when one version of a set of ...
5
votes
1answer
781 views

LDF and MDF file sizes for a dynamically created Database

I am creating a dynamic database from C# code, and would like the database to have a fixed size (for example 5 GB). While creating the DB through code, I need to specify MDF and LDF max file sizes. ...
3
votes
4answers
2k views

tempdb in sql server

Using SQL Server 2000, I am getting the following error. The log file for database 'tempdb' is full. Back up the transaction log for the database to free up some log space." How to solve it? I ...
2
votes
1answer
845 views

Update Schema in SSIS Export Package When Source Schema Changes

I have servers with lots of client databases, all with very similar, but not necessarily identical schemae. Some customers want their data in MSAccess on a monthly basis. This was getting tedious to ...
3
votes
2answers
445 views

How do I calculate working business minutes?

I'm working on business inteligence reports and one of my task is to create reports for time tracking. I have to report on business minutes (10 hours per day) within business week (monday to ...
2
votes
5answers
196 views

How can I store function names to be executed on a subset of rows?

I have a table, accounts, which contains the vast majority of the data I am concerned with. accountTypes contains different types of accounts (Business, Personal, etc.). I want to perform calculations ...
2
votes
4answers
117 views

Backup Scenarios

In My Computer, on C drive I have a Database of 50GB and I want to take backup of that 50 GB data to other drives D,E,F but D,E,F Drives contain only 20 GB for each. In this scenario how can i take ...
6
votes
5answers
7k views

SQL Select taking too much time to execute

It's a simple select from a temporary table, left joining an existing table on its primary key, with two sub selects using top 1 referring the joined table. In code: SELECT TempTable.Col1, ...
3
votes
1answer
505 views

Is using CRUD stored procedures against a view with NOLOCK bad?

(I am crossposting this from SO on the suggestion of a commenter) Our DBAs have created a pattern where our database layer is exposed to EF via views and CRUD stored procedures. The CRUD works ...
2
votes
1answer
2k views

Tool to Convert MySQL DB to MS SQL 2005 (Especially stored procedures) [closed]

Is there any tool to convert MySql db to MS SQL 2005. I am mostly interested in converting Stored Procedures. There are 100s of procedures and writing them again in T-SQL is a big job. Thanks.
3
votes
1answer
1k views

No “Using locked pages for buffer pool” in SQL Server log

As a trial run for a client I am trying to enable the "Lock Pages in Memory" setting on my development server, but no matter what I change, I cannot get the "Using locked pages for buffer pool" to ...
1
vote
1answer
158 views

Duplicate record problem

create table #Personel ( Ad varchar(100) ) create table #Masa ( MasaAdi varchar(100) ) insert into #Personel values('deneme1') insert into #Personel values('deneme2') insert into #Personel ...