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

Update primary key column - NULL issue

I want to update a column that is a primary key using this code use BITS_TEE Update DMT_TEE_DTS_Production set ABCIndicatorCode = ( select HIST.ABCIndicatorCode from ...
1
vote
1answer
38 views

Change rowguidcol property to a different column

In my SQL Server 2008 database, I have a table with two uniqueidentifier columns. CREATE TABLE MyTable ( Col1 uniqueidentifier rowguidcol not null, Col2 uniqueidentifier not null, ...
4
votes
1answer
58 views

Incorrect result when you execute a query that uses WITH RECOMPILE option in SQL Server 2012

I just read the Brent Ozar Weekly Links email (July 28th Edition), and noticed the "Kendra's Link" talking about "Fix: Incorrect result when you execute a query that uses WITH RECOMPILE option in SQL ...
0
votes
1answer
34 views

Case always returns null?

I have a subquery that gets the DATEDIFF of two dates. However the first case always returns null yet the actual sub query returns dates?! CASE WHEN [date1] > [date2] THEN ...
1
vote
0answers
10 views

Spatial Index ignored when using additional non-spatial conditions

Why does SQL Server ignore my spatial index when I use additional conditions? If I add an INDEX hint it will use the correct index, and runs a lot faster. I would like to avoid using the hint if ...
0
votes
0answers
57 views

1 TB Database import, best options? [on hold]

Friends, We have received 1 TB external hard drive with 750 GB MS SQL server zipped backup file in it from our client. We need to import this database at our end and then write programs to retrieve ...
0
votes
1answer
29 views

Select IDs according to CSV file

I have a CSV file with IDs of rows. I want to use that to make a SELECT statement selecting the IDs within that CSV file. There is 1 million rows and I want to select about 95,000 of those. I want ...
3
votes
1answer
40 views

Sql Server Management Studio login prompt will never forget other sql user than SA

When I login to a database, using some other user than SA, that username will stick the next time I login. If I then input the username SA and password and logs in, the next time I open the login ...
1
vote
1answer
37 views

Fixing an error 9004 without taking the database offline

My database (SQL Server 2008 r2) is running fine but I’m getting the following error in my event log. Error: 9004, Severity: 23, State: 6. An error occurred while processing the log for database ...
2
votes
2answers
47 views

Help reading deadlock XML

Even with reading the Bart Duncan blog about reading deadlocks I still struggle with this. I have included the XML from a particular deadlock. <?xml version="1.0" encoding="utf-8" ?> - ...
2
votes
4answers
67 views

Large table with historical data allocates too much of SQL Server 2008 Std. memory - performance loss for other databases

Based on this question and the answers given: SQL 2008 Server - performance loss possibly connected with a very large table I have discovered memory allocation problem with SQL Server 2008. ...
1
vote
2answers
28 views

Store n:m data with most n:1 tuples

I have these tables: create table data ( id int identity not null, ref int not null ); create table reference ( refid int not null ); with ~2 million rows in data and ~200k rows in ...
0
votes
2answers
26 views

Get the table affected by the query

How I can get the table which is affected by the query? Example Update cust Set name = 'john' Where custid = '4001' Output: cust ___________________________ Insert into emp(fname, lname) ...
-1
votes
2answers
40 views

SQL Server 2012 Browser Service doesn't appear [on hold]

I've installed SQL Server 2012 and Management Studio Express. I attached the database that belongs my previous Project in Visual Studio. But I am having SqlException Error , I think the reason of the ...
1
vote
1answer
39 views

Cluster Size Configurations for SQL Server at RAID Level

I was reading the below two articles (one of which I posted) and one recommends to use a RAID cluster stripe size of 256k while the other recommends to use 64k. There is a big difference between the ...
0
votes
1answer
38 views

Migration query taking time

I'm doing a migration from Oracle to SQL Server and, for one of the tables where we have 3 million records, it is taking a lot of time to complete. When I check the activity monitor, I can see the a ...
0
votes
1answer
74 views

INSERT/SELECT slow after TRUNCATE TABLE on table with 6 over mllion rows

Seeing slowness in insert/select after truncating a table that has over 6 million rows. I daily insert 5 to 6 millions records into a table and I was able to insert/select data without any issue for ...
0
votes
1answer
52 views

Migrating SQL database to a new SQL server

Thanks for viewing my question. I currently have a database on SQL Server 2005, which is being migrated to SQL Server 2008. Each SQL Server is named differently in SSMS. The old is named GARDB1, and ...
-5
votes
1answer
37 views

How to fix the SQL from SQL Server to Oracle? [on hold]

There is the SQL using in SQL Server: select l.depart_code, l.depart_name, y.HR_NO, y.HR_NAME, m.PAY_SCOPE, x._per, x._com from psr_main m, hr_depart_data n, hr_depart_data l, (select ...
3
votes
0answers
48 views

Does anyone have example for setting up a job to reduce SQL Server max memory and recycle SQL server service?

I have both SQL Server 2008 and SSAS running on the same machine (Don't ask me why, I have to live with it for now!). Since we run ETL and Cube generation in sequence, I wanted to allocate large ...
1
vote
3answers
75 views

How do I select 1st row of each table and insert that data to a new table

i have 5 tables (tab1, tab2, tab3, tab4 and tab5) and all the 5 tables has same table definition. I want to select 1st row of each table and insert those 5 rows in new table(newtab). I was only able ...
3
votes
1answer
51 views

Differential/T-Log LSN question

So, this is now my third question on this topic. I just keep finding more and more than i want to know and understand about how FULL recovery works. We transitioned a database to FULL yesterday by ...
0
votes
1answer
68 views

Is this a good case for multiple SQL instances on a VM?

We have a suite of applications utilizing SQL Server have the following characteristics: Users create/destroy DBs via a UI, so DBs appear/disappear without DBA assistance. DBs of the same name can ...
1
vote
1answer
19 views

Troubleshooting Resource Governor / Classification Function

I've been trying to configure / troubleshoot the resource governor on a sql server 2014 instance. I can't get any work into anything but the default resource pool. I've been following this ...
0
votes
1answer
35 views

sql server Group by with calculated values

I have two tables: costumer table and invoice table. How to calculate sum(value) for each costumer (id) when I have calculated variables in group by statement - without puting code for calculated ...
0
votes
1answer
39 views

Page compression not working?

I have created a table where I have around 100 partitions (per month), all of them are configured to use page compression. After that I'm inserting data to this table month by month. I now would ...
0
votes
1answer
33 views

Risk of disabling page locking

In another question a user asks how to force row level locking. The answer that he receives tell them how to force row level locking by altering the table and the indexes. The user that answered the ...
0
votes
2answers
61 views

View with left joins are very slow

I have a view based on join of 3 tables and and query on view is taking 10 mins to fetch the results. Can anybody help me in reducing the time taken to fetch results? VIEW CREATE view ...
0
votes
1answer
48 views

Need Advice on Normalizing Database

I have a group of database tables that lack normalization. They all have a similar primary key called 'doc_index', which is either a PK by itself or part a composite PK. As you can see below, there ...
3
votes
5answers
221 views

Using Timestamp plus Integer as Primary Key

In Sql Server, what would the drawbacks and disadvantages be of using a primary key that is: Two Character Table Identifier + YEAR + MONTH + DAY + HOUR + MINUTE + MILLISECOND + random integer between ...
1
vote
0answers
27 views

Column Data Type for Bitwise Comparison?

I have a table where I have an int32 column storing values for bitwise comparison. I've ran out int space with a int32. I can convert to int64 but that will just prolong the inevitable. Is there an ...
3
votes
1answer
50 views

Is support for Parallel Scalar UDF a reasonable feature request?

It is fairly well documented that scalar UDF's force an overall serial plan. Running functions in parallel Given a large number of rows coming into a point in the pipeline where a UDF must be ...
7
votes
6answers
770 views

Estimate projected database growth

I recently started working with SQL Server 2008 as a DBA trainee. I need calculate the size of the database but also estimate its growth over recent months and the predicted growth for the next 12 ...
0
votes
0answers
19 views

Derive daily delta from total daily counts? Tsql

I have a table with columns: ID, tableName, totalRowCount, Date Each day I'm appending the number of rows in the relevant table. What I want to do is create a table which has the number of new ...
0
votes
1answer
24 views

Nested cursors, multiple result sets

I'm using a SQL Server stored procedure to generate an Excel report. Basically each "entry" in the report has three parts: Object, Observation, and Points. The observations have a reference to the ...
3
votes
4answers
133 views

Are we a good fit for SQL Server Enterprise and table partitioning?

We currently have a production database that contains millions of records (14 million in the largest table). One function of the database is to provide time sheet information so a single table could ...
4
votes
1answer
72 views

Splitting a csv column from select query into multiple columns

I have a stored procedure SELECT [ShipWorks].[dbo].[OrderItem].[Code] AS Code, CASE WHEN (LEN(ISNULL(MAX([ShipWorks].[dbo].[OrderItem].[Location]),'')) = 1) THEN ...
0
votes
0answers
7 views

Error in 'Master Database Restore' in SQL Server 2012 (Because of difference in SQL Server Build)

I have a backup of a master database that was taken from SQL Server 2012 11.00.2218 build. Now I have a new SQL Server installation with build 11.00.2100. I tried restoring the master database after ...
2
votes
1answer
23 views

Sql Server data files in Windows Azure

excuse me for my bad english I just created a database using the new functionality "SQL Server 2014 data files on Windows Azure" and works quite well, however, I have a table with a Billion records, ...
0
votes
0answers
13 views

Export sql server table connections schema

i am using RazorSQL to connect to a Microsoft SQL Server database. I am looking for a way to visualize the tables connections schema. Do you have any idea how I can export such a view?
1
vote
2answers
22 views

best way to deal with imperfect xls source file that needs to be imported into SQL via SSIS

The data is formatted like this: Date Type Account 1/1/14 AAA 111 112 113 BBB 114 115 ...
2
votes
1answer
35 views

Can SQL Server stop me from running an UPDATE statement without a WHERE clause?

Whenever I have to run an update statement, I always get nervous that I might forget the WHERE clause and overwrite the entire column in the database. Is there any setting or plugin or addon I can ...
3
votes
4answers
480 views

How do I place leading zeros for numbers less than 10 without affecting those 10+?

Probably a newb question, but... I have a table with a VARCHAR field containing numbers 1 through 300. I need to place a leading zero in front of any numbers less than 10 while retaining the original ...
0
votes
1answer
27 views

Getting null block_st.text when querying for blocks

We are using the blocking query from this article which queries sys.dm_tran_locks. http://simplesqlserver.com/2013/05/21/blocking-capturing-and-monitoring/ The issue we've ran into is that often ...
1
vote
1answer
60 views

Restore Verify Only w/ Transaction Log Backups

Question When RESTORE VERIFY ONLY on a transaction log backup fails, what do you do? Background After FULL and DIFFERENTIAL backups, I run RESTORE VERIFY ONLY on the backup file(s). This rarely ever ...
1
vote
2answers
131 views

SQL 2008 Server - performance loss possibly connected with a very large table

Migrated from http://serverfault.com/questions/615129/sql-2008-server-performance-loss-possibly-connected-with-a-very-large-table We have SQL Server 2008 with 3 active databases running on it. DB1 ...
2
votes
1answer
58 views

Implementing application locks within SQL Server (Distributed Locking Pattern)

In my application I have to perform a distributed locking pattern. Because we already have an instance of SQL Server to use, we decided that it would be easiest to implement the locking at SQL layer ...
0
votes
3answers
49 views

How to display posted on date and time like1 hr ago or 30 min ago

i want to show the posted date like 1 hr ago.. or 30 min ago.. declare @date datetime ='2014-07-24 11:50:22.033'; SELECT CASE WHEN DATEPART(DD,@date)=DATEPART(DD,GETDATE()) THEN CASE WHEN ...
0
votes
1answer
21 views

SQL Server NULL values UNDO

I mistakenly updated the null values in my table to a string similar to an already present string. For e.g. I changed the NULL values to 'WL:5' and there were records for 'WL:5' already present. I ...
0
votes
3answers
51 views

Matching two rows in a single table if two specific keys have different values

I have a table called settings in that there are two columns and data like following. settings value ------- ------ depots 12 projectid 156 client ...