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
1answer
703 views

how to transfer data from table to table

I have two tables Table1, Table2. From Table1 want to transfer data to Table2. Suppose I have the following query: Select * from Table1 where UserID between 5 and 10 I want to store above ...
0
votes
2answers
51 views

Failure to log in using just the server name

I have more than one PC connected by LAN that I access from Server Management Studio. When I try to connect with the DB server, if I place the server IP instead of the server name in the serverName ...
2
votes
1answer
499 views

How to get server event notification

I'm just getting into sql-server, so forgive me if this is a basic question. I'm building an application using .NET 4.0 and VS 2010 and ms-server2008. For my application I need to detect the server ...
0
votes
1answer
138 views

Help me to better design my query so I can gain more performance

I need to find so called first entry in database for items regarding their partners. I wrote query and it is giving me correct results but it sucks with performances. I suspect that I have missed ...
4
votes
2answers
1k views

How can I speed up a query that orders by a calculated field?

I will try and give an example - this is not my table structure - I'm simply trying to outline the issue in order to find a solution... Person Id, Name BrothersNames Id, Name SistersNames Id, Name ...
7
votes
3answers
7k views

Executing Stored Procedure that accesses another SQL instance

I apologize if this question repeats another already asked. I have searched for hours and have not found one that fits my situation. Desired Outcome A user using SQL authentication has execute ...
0
votes
2answers
520 views

SQL Server 2005: Job scheduled every 4 hrs, but sp_help_jobactivity shows unexpected value for next_scheduled_run_date

I have done a lot with sql and jobs, and this is throwing me off. My job is scheduled as shown below. I can run the job interactively from SSMS by starting the job, it runs, all is well. It is ...
2
votes
3answers
2k views

SQL Server Max number of Times a table can be referenced as a foreign key?

Is there any maximum on the number of times a single table can be referenced in a SQL Server database via foreign key? IE Table A A_ID Table B ~ B_ID, A_ID Table C ~ C_ID, A_ID Table D ~ D_ID, ...
6
votes
2answers
1k views

securely exposing sql server 2008 for windows authentication

My company wants to have approximately 100 of their sales people (distributed around the country) to be able to run stored procedures from excel and return the data onto the spreadsheet. We have sql ...
18
votes
1answer
12k views

SLEEP_TASK Wait Type in SQL Server - What does it indicate?

I haven't seen the SLEEP_TASK wait type before, and today I seem to be getting a ton of them. I'm not the official DBA, just a SQL Server developer who knows some DBA stuff. We upgraded our servers ...
8
votes
3answers
2k views

SQL Server - Multiple running totals

I've got a base table with transactions and I need to create a table with running totals. I need them to be per account and and also have a few running totals for each account (depending on the ...
2
votes
1answer
334 views

Immediate e-mail alerting for error 229 (permission denied)

For a few reasons, I'd like to have all permission denied errors (number 229) emailed to me. Checking master.sys.messages shows that is_event_logged for this error is 0. Thus that rules out using SQL ...
5
votes
3answers
1k views

SQL Server making arithmetic abort enabled

I am using SQL Server 2008. In my stored procedures, I often have to call for XML data type, functions (like split). Is it possible to permanently enable arithmentic abort for a database? I know it ...
1
vote
1answer
613 views

Insert 4 tinyint values into varbinary(4)

I'm working on a function to convert the string representation of an IP into its varbinary(4/16) form. Right now, I have this: @stringIP = '192.168.0.3' select CAST(PARSENAME(@stringIP, 4) as ...
4
votes
2answers
1k views

Scrubbing Names via SQL Query/Batch

We have sensitive information (names of people) and we're looking to put into place a script to "scrub" of the names. Has anybody come up with a good algorithm to do this, something other than just ...
3
votes
2answers
964 views

How do I replicate SQL Server index INCLUDE and STATISTICS functionality on PostgreSQL?

I'm working on a project that must support two database engines; SQL Server and PostgreSQL. We are using NHibernate as the ORM. We are running into performance issues with certain queries. Using ...
5
votes
4answers
3k views

T-SQL INNER JOIN Optimisation

Well, I really have read so many articles, used different techniques and done some random things to do this. My problem was that a have big tables (over one million rows) and some small (with few ...
2
votes
1answer
827 views

Why use custom CLR aggregate functions for string concatenation and geometry unions in SQL Server?

I often need to do string concatenation or geometry unions over a column in SQL Server 2008 and I'm aware that you can write custom aggregate functions in .NET and register them with SQL Server to do ...
2
votes
2answers
1k views

SQL Server: Do Statistics Updates cause query plans to be flushed? Should they?

I've found that a big, nasty data-extraction query that runs daily needs updated stats to avoid making horrible query plans based on incorrect rowcount estimates (let's not worry about whether or not ...
2
votes
2answers
921 views

SQL Job in idle state

A created a new SQL Job in SQl Server Agent. I followed the steps mentioned in the article http://msdn.microsoft.com/en-us/library/ms187910.aspx Still it is in idle state. PLease note that the ...
1
vote
2answers
247 views

How to get the free temporary memory available in a server

How to get the free temporary memory available in a server For example:- I am running one SSIS package to upload data to tables. First it will move all the data to temporary table and then it will ...
3
votes
1answer
139 views

should we replace some non-clustered indexes with clustered indexes

We have some data saved for reporting each of our tables currently has a unique id column that has an auto generated clustered index on the pk and a non-clustered index for the fk. I am thinking that ...
2
votes
2answers
314 views

Validate and Verify Data After SAN Migration

We are preparing to migrate to a new SAN and I have been tasked with verifying/validating data after migrating a server. Other than the DBCC commands that would tell me about data integrity, and ...
1
vote
2answers
76 views

SQL Server 2008 error when changing cores

I have a virtual machine (virtualbox) with Windows Server 2003 and SQL Server 2008, running with 4 cores. I wanted to use 6, but when i changed the machine configuration, for some reason SQL Server ...
4
votes
1answer
772 views

setup transaction replication in cross domain

I'm trying to setup transaction replication between two domains under the same active directory. The publisher server is in a DR site domain and the remote distribution server is in the main site ...
11
votes
2answers
3k views

SQL Server VARCHAR Column Width

Searching around the web, I have found conflicting advice on whether there is a performance impact when specifying overly-wide VARCHAR columns, e.g. VARCHAR(255) when VARCHAR(30) will probably do. I ...
7
votes
1answer
327 views

Could Stack Overflow run on SQL Server Web Edition?

I am starting a new web venture that may need to scale to a high number of users. I am confident with the SPLA licencing for SQL Server Web edition, but want to know if I will need to factor in ...
1
vote
4answers
120 views

copy ldf from one server to another

I keep getting "file is open in another program" when i try to copy LDFs from one production to dev. Is there another way to copy these ldfs to dev server?
4
votes
1answer
2k views

SSIS how to parse column with erratic data

I have a question on how to parse out a column and hoping a SSIS/Database guru can help out :) Here is the problem. I have a column saved as a string/varchar format in SQL Server, and need to parse ...
3
votes
2answers
4k views

Can someone explain why select with nolock will query a potion of updated data?

I was reading the answer from here (from stackoverflow, I think should ask in here) NOLOCK means placing no locks at all. Your query may returns portions of data as of before UPDATE and ...
3
votes
1answer
384 views

Shrinking log file

Some of the sql log files (idf) are hugh like 5gb. Found a article (http://extended64.com/blogs/rhoffman/archive/2009/06/11/shrink-sql-server-2008-database-log-file-script.aspx) but not sure why he ...
0
votes
1answer
298 views

Shrinking log file [duplicate]

Possible Duplicate: Shrinking log file Some of the sql log files (idf) are hugh like 5gb. Found a article ...
1
vote
2answers
150 views

xSQL trace file error

I am trying to use this programme that goes by the name xSQL Profiler but the problem is that it keeps giving me a error where it says: Trace mietrak did not start. Please check if the Trace File ...
2
votes
1answer
260 views

SQL Server Cluster Failover Making DB Inconsistency Error

I encountered the following DB tables inconsistency error whenever I do a cluster 'move' over from Server-A to Server-B and then do a DBCC CHECKDB on the database in Server-B: SQL Server detected ...
3
votes
1answer
875 views

Rebuild or Reorganize indexes based on fragmentation

I am using an Index Defrag Script, which provides a nice way to rebuid or reorganize indexes based on fragmentation percentages. I like to rebuild my database indexes if their fragmentation is over ...
15
votes
9answers
2k views

Version control for database objects

The database our developers are working on is too large (have a lot of database objects). We have to control db objects changes (change management). Our company cannot have a person who would be ...
0
votes
3answers
42 views

helping hand for sql server resources

I'm just getting into SQL-SERVER, so forgive me if this is a basic question. I need help, recently work on database programming, For my query development, to understand complex query, to can ...
2
votes
2answers
2k views

SET LOCK_TIMEOUT, is it session or statement based?

For what period does the LOCK_TIMEOUT LAST? I do a "SET LOCK_TIMEOUT 10" and a "SELECT @@LOCK_TIMEOUT" in one command after a login and get 10 returned. Immediately after this I do a "SELECT ...
68
votes
4answers
9k views

Why are numbers tables “invaluable”?

Our resident database expert is telling us that numbers tables are invaluable. I don't quite understand why. Here's a numbers table: USE Model GO CREATE TABLE Numbers ( Number INT NOT NULL, ...
3
votes
2answers
316 views

Is it important to release memory back to the server?

I have a SQL Server 2008 R2 instance running on a production system. I'm not a DBA; I'm more a developer, but my client is currently asking me: How important is it to release memory from SQL Server ...
3
votes
3answers
712 views

t-sql - combinatorics

I'm trying to find all possible character combinations in a variable length string. For example: '--' would have 2^n = 2^2 = 4 possibilities, 'x-', '-x', 'xx', '--' I think that essentially I need ...
6
votes
4answers
1k views

What is the fastest way to reset SQL Server database if you can not use RESTORE?

I have integration tests that require test database to function. Since tests should generally be independent, I reset the database in the beginning of each test. I can not use RESTORE, since some ...
1
vote
1answer
148 views

Is it possible to allow write-through computed columns for legacy code that expects a column to be read/write?

I have this existing table for IP storage: CREATE TABLE [dbo].[IPAddresses]( [ID] [int] IDENTITY(1,1) NOT NULL, [IPv4Address] [varchar](15) NULL, [IPv6Address] [varchar](45) NULL, ...
2
votes
1answer
419 views

How to retrieve / read SQL Image Data which is stored in the database?

From one application, we are storing all images in SQL database in the Image datatype. From another application, i need to retrieve the images and display it on User Interface. I am able to store the ...
2
votes
1answer
514 views

SQL Drive getting full delete millions of rows

I'm looking for the easiest way to accomplish this in the limited hard drive space that I have. I have a SQL drive that is dangerously close to getting full. We have about 15 tables that have over ...
10
votes
2answers
3k views

Do SQL Server Express Editions support CLR procedures?

Do SQL Server Express Editions (2005, and 2008) have support for installing, enabling and running CLR Stored procedures and functions.
3
votes
1answer
2k views

Found important issue with SQL Server 2008 R2. Need Advice

Recently while installing my copy of SQL Server 2008 R2; the power went OFF. So now it does say the some features are installed and some are not but when I run SQL server detection manager it says ...
1
vote
2answers
9k views

Select multiple rows from one row based on column values

I have a product table where the value of two columns can imply either one or two actual product results. If column X = 1 AND Y = 0 return one result, if X = 0 and Y = 1 return one result, if X = 1 ...
2
votes
3answers
299 views

What affects the speed of a count(*) besides the number of records

I have a query like SELECT COUNT(*) FROM Foo Where Bar = 1 AND Baz = 2 the table has 12934600 records of which 1000001 match that predicate Looking at the query statistics I see (1 row(s) ...
0
votes
1answer
1k views

SQL Server 2008 R2 SQL Server Profiler and “exec sp_reset_connection”

Yesterday i ran the "SQL Server Profiler" tool and outputted the data to a table, now when i look in it i find many "exec sp_reset_connection" rows and thats expected with our data access layer! But ...