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

When do you add your foreign keys?

I'm scripting out a fairly simple database so I can simply hand off a script to someone else for an application to use. I'm curious about where best practice/the community stand on this: When should ...
4
votes
4answers
301 views

Table join to match without duplicates

I have a situation where I need to match arrivals and departures of assets in a location. The problem is that asset movements are not always entered into the database chronologically, nor is there ...
5
votes
3answers
2k views

Can a database's files be copied while a database is online?

I'm working on setting up a development copy of a production database on SQL Server 2008 R2 SP1. The live database is getting lightly used by two developers for read only queries currently, but the ...
3
votes
1answer
227 views

Cumulative Game Score SQL

I have developed a game recently and the database is running on MSSQL. Here is my database structure Table : Player PlayerID uniqueIdentifier (PK) PlayerName nvarchar Table : GameResult ID ...
-3
votes
1answer
115 views

SQL Server: Month Range Join [closed]

Given that there are two dates like 2012-07-08 and 2013-02-06. I need to count record of each user for every month. If there is no data for a user in particular month then it should return zero. The ...
3
votes
2answers
3k views

Difference between Full backup and Copy-only full backup

I saw in this link that full backup does not truncate the log. So what is the difference between full backup and copy-only full backup? For the log backup there is copy-only backup which prevent the ...
3
votes
5answers
347 views

Extract data to another computer

I have SQL Server 2008 R2 Express edition, and I want to export the data in that database to another computer so I can import it again in that computer. How please? What I have tried Right-click ...
2
votes
1answer
117 views

Import issue with Replication

When I import some data from excel file to a table that is part of a merge replication, the data is imported successfully to the table, but those new records are not synced to subscribers that belong ...
3
votes
3answers
1k views

How do I monitor bandwidth used by SQL Server on port 1433?

I have a single server running a .NET web application and a SQL Server database (2008 Standard). I'm planning to move the database onto a separate server but in order to provision the network hardware ...
-2
votes
1answer
307 views

If there exist multiple similar Values than show Sum of a another column else Show simple Value [closed]

I am having a probelm. I have a table of Invoice with different Invoices. Each Invoice has a unique Invoice Number and some amount. Invoices are of two type. One is of Invoice Type, and the other is ...
4
votes
1answer
32 views

How to provide a access to the data base if the user is not having the privilleges

In MS SQL Server 2008 R2 is installed by a user "A" and he has a data base named "DB1" . He left the company. Now the user "B" is trying to access the data base. He is able to see the data abse and ...
1
vote
3answers
276 views

SELECT lock only for inserts [closed]

I need to get the MAX aggregate of certain field in a transaction. I use this value further inside the transaction. I want to avoid inserts in the entire table from which I'm getting the MAX while the ...
2
votes
2answers
1k views

Greyed out menu options, broken activity monitor

I recently installed SP1 on my 2012 SQL Server. Ever since then SSMS has behaved a little weirdly when I connect from my pc rather than from the local server itself. I no longer see the green ...
-6
votes
1answer
2k views

Using inner join to get data from multiple tables [closed]

I have 5 tables: A(a_id, a1, a2); B(b_id, b1, b2, a_id); C(c_id, c1, c2, b_id); D(d_id, d1, b_id); E(e_id, e1, e2, d_id); table b have a_id match with table a(a_id). table c have b_id match ...
5
votes
2answers
383 views

How to design index for faster deletes

I want to speed up following piece of code delete from ssn_sdo where (art_id=@art_id and skl_id=@skl_id and @level=0 ) or (art_id=@art_id and skl_id=@skl_id and @level=1 and ...
2
votes
2answers
295 views

Deadlock occur in a delete insert scenario

<deadlock-list> <deadlock victim="process14012e08"> <process-list> <process id="process14012e08" taskpriority="0" logused="148" waitresource="PAGE: ...
2
votes
1answer
653 views

Does SQL Server 2008 have an equivalent to Oracle's “table%rowtype” syntax or (Data Type)?

In Oracle PL/SQL scripts, you can declare a variables using the syntax tablename%rowtype for its type. This will make that variable have the same "type" as a row of that table (i.e. a it will be a ...
3
votes
1answer
240 views

Security for Oracle linked server from SQL Server

I'm trying to make the linked server from SQL Server 2005 to Oracle more secure by not having user/pass on "Be made using this security context:" fields so only a specific user can access the data ...
0
votes
1answer
45 views

Best What's new book about just changes and new features in SQL Server 2012 [closed]

I want to read about new changes and new features in SQL Server 2012.I found some E-Book in the internet but they have basic topics (like create Tables,Views,...) I want a book that just cover new ...
2
votes
1answer
67 views

ALLOW_SNAPSHOT_ISOLATION Duration

I would like to enable ALLOW_SNAPSHOT_ISOLATION on a production database that has ~400 million total records. I understand that 14 bytes will need to be added to each record. If I set ...
1
vote
0answers
311 views

Configured values different to Running values, even after full restart

I am trying to change the FILESTREAM Access Level property on a SQL Server Express database. The Configured values section of the Advanced tab of my Server Properties dialogue box looks like so: ...
3
votes
2answers
1k views

What are Measures and Dimensions in Cubes

I'm very new to Microsoft Sql Server Business Intelligence and Analysis Service(but I'm programming for years with SQL Server).Can any one describe Measures and Dimensions in Cubes in Simple words(If ...
-4
votes
0answers
68 views

Multi-row INSERT rejected? [closed]

What's wrong with my query? :( USE tempdb; IF OBJECT_ID('dbo.OrderTotals', 'V') IS NOT NULL DROP VIEW dbo.OrderTotals; IF OBJECT_ID('dbo.OrderDetails', 'U') IS NOT NULL DROP TABLE dbo.OrderDetails; ...
1
vote
1answer
93 views

Can a database restore fail after it has begun?

I've noticed that a lot of times if a database restore is going to fail, it will fail before it even starts restoring in SQL Server 2008 Management Studio (displaying an error about space or something ...
1
vote
1answer
59 views

Restoring a backed up database fails

I have backed up a database (full backup) and was attempting to restore as a new database (different name). However when attempting to restore it I get the following error: The transaction log for ...
4
votes
1answer
387 views

Partitioning / indexing an extremely large table

I'm working on indexing and partitioning a single data warehouse table that weighs in around 500 GB. The table is a heap, has over a hundred TEXT columns, and the TEXT_IN_ROW option is enabled. I ...
4
votes
1answer
445 views

Default trace enabled but not active

When I query the configuration of the default trace, it shows enabled: exec sp_configure 'default trace enabled'; --> name minimum maximum config_value run_value default ...
-2
votes
1answer
449 views

How to run steps in one job sequentially [closed]

I have one job on SQL server Job Agent that has 3 steps. I want to the job to run starting with step one. After step one is complete and only when it completes I want step 2 to start running and so ...
8
votes
1answer
843 views

On which machine should TCP Chimney Offload be disabled?

I am advising someone on how to disable TCP Chimney Offload, which is enabled by default by Windows Server 2003 SP2. We are working in an environment with multiple server machines, namely the ...
7
votes
3answers
996 views

Dealing with identity ranges for transactional replication

I've noticed that when you set up a transactional replication, SQL Server will set identity range management to manual. What this means is that in my subscription database, when I try to insert a new ...
0
votes
2answers
3k views

What is the difference between TCP port and TCP dynamic port?

Can anyone tell me the difference? I tried to set either 1 port and left another blank also can work. I wonder what is the difference, or anything I missed out?
3
votes
3answers
771 views

SQL Server freezes (because of application), need logging

We have an application running ontop of our SQL Server 2005 instance and a couple of times a week this application (unannounced) will cause the SQL Server to freeze. I can't even restart the SQL ...
3
votes
1answer
397 views

Will table partitioning speed up my queries?

My database is set up with what we call our staging tables and our live tables. Currently for we have about 2 million rows for a table called products. Our customers we call manufacturers load their ...
4
votes
1answer
469 views

What does the wait type PREEMPTIVE_XE_CALLBACKEXECUTE mean?

I have two instances in the last week where a DROP command for an Extended Events session has taken over a day to complete, sitting with the wait: PREEMPTIVE_XE_CALLBACKEXECUTE. Can anyone explain ...
3
votes
1answer
157 views

Transactional Replication - Snapshot metrics

I have an application that is using Transactional Replication. We are using snapshots to initialize the subscriptions. All publishers and subscribers are using SQL Server 2008. Due to the way our ...
0
votes
1answer
128 views

Update column value in entire database [closed]

In my database, I have around 30 tables, each with an emp_number (INT) column. How can I update the value of emp_number in all 30 tables?
1
vote
1answer
641 views

How to call an Oracle Function with multi out Parameters though LINKSERVER

I need help as I am facing this problem. when I pass 2 output parameter to a function through a linked server I am getting this error. For 1 out parameter its working fine but when I use two output ...
-3
votes
2answers
454 views

How/Where to get date/time/calendar data to store in a table? [closed]

I cannot recall where I got the data before so I'm asking here: Where can I get or how can I generate standard date/time/calendar data? The table would consist of columns such as: main_date -- ...
0
votes
2answers
2k views

How to select rows which have max and min of count?

I have the following table in SQL Server 2012: CREATE TABLE [MyTable] ( [Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY DEFAULT NEWID(), [MyGroup] INT NOT NULL ); I want to output a table of the ...
-1
votes
0answers
790 views

Setup has encountered the following error: Value cannot be null. Parameter name: doc [closed]

I have SQL Server 2008 R2 installed on my server. I want to upgrade it to SQL Server 2012 Service Pack 1. I got this Error during the installation: SQL Server Setup has encountered the following ...
2
votes
1answer
1k views

Transactional replication altering tables and adding stored procedures

I have a database that is replicated in several locations. It is setup as transactional replication. However, now I need to add more columns to the table. Add more stored procedures and etc. Hence, if ...
0
votes
1answer
575 views

What's a good way to model user authorization to hierarchical data?

I'm wanting to implement something that's basically an ACL in SQL Server (2008, we'll be moving to 2012). We're working with farm production information. We will have users who need to be authorized ...
2
votes
0answers
135 views

This is just to demonstrate a display bug

...and now has been updated to demonstrate a comment thingy on SO meta. Unless I asked you to, please do not act on this question, even if it appears in the suggested aardvark edit review queue or ...
1
vote
1answer
185 views

How to edit publication's generation_leveling_threshold configuration value

I dont know where I put this code: update sysmergepublications set [generation_leveling_threshold] = 0 I only need do it. But I need edited any funcion of agent.
1
vote
1answer
2k views

Login failed for user Error: 18456 State: 10

In one of my vb.net applications I am getting the error Login failed for user 'user'. But the user has full permission (sysadmin). Also this error happens intermittently. Error log has the following: ...
-1
votes
1answer
112 views

Query performance in SQL Server [closed]

What factors should I check when I compare the performance of a query? I saw many articles stating about IO cost, subtree cost (by using Execution plans), statistics such as CPU time, elapsed time ...
0
votes
1answer
1k views

Diagnosing Blocking issues using Blocked Process report

I have an application that is going down as a result of timeouts. During these times we see a massive spike in response times from the database that holds ASP session state. In an effort to to ...
0
votes
1answer
240 views

Compatibility level for published database and transactional replication

I am running a database on compatibility level 80 because the application using it does not yet support a higher level. It is my understanding that transactional replication on SQL Server 2005 and ...
1
vote
1answer
258 views

Full-text Catalog Corruption

I have a SQL Server 2005 database that I backed up and restored onto a new server running SQL Server 2012. So far so good. This morning I had a really bad power outage and the new server went down. ...
3
votes
1answer
391 views

Forcing Join Order

I have a table with just over a million rows. These rows can have a parent record in the same table which is found by joining to itself on 6 different columns (i.e. there is no single ParentID ...