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)

2
votes
1answer
500 views

How would you implement conversation groups/ locking for multiple users of a Service Broker Queue?

How do you implement conversation groups for multiple users using their own instance of the user applications but sending related messages to the service broker queue? Any good example of this kind ...
2
votes
1answer
803 views

performance issues when concurrent requests

We are using SQL Server 2008 R2 on a Windows Server 2008 server. We have some main functions which uses some Stored Procedures which has a lot of sub-queries inside of it. I'll take one SP as an ...
2
votes
1answer
105 views

Associate a piece of data with a session

I think I want to associate a piece of data with each session. The association must have the following properties: The data being associated is provided either as a part of connection string (if ...
2
votes
1answer
427 views

Stored Procedure doesn't show result in SQL Server

I have created a stored procedure (to be used in SSRS) that has parameters whose values are more than one. When I execute this stored procedure in SSMS by providing the values for that parameter, SP ...
2
votes
1answer
390 views

How to change ANSI_NULLS option for a table?

I have a table that mistakenly has ANSI_NULLS option set to OFF. I'd like to set it ON for this table. The table has millions rows of data. Is it possible to change this option without creating a new ...
2
votes
1answer
519 views

Escaping a single quote in SQL Server

The recommendations I have come across advise that single quotes in SQL Server should be escaped using two single quotes. Thus Ravi's becomes Ravi''s. Another alternative is to use parameters. In ...
2
votes
1answer
103 views

don't want to be able creating stored procedures with incorrect

Right now I can execute a CREATE PROCEDURE or an ALTER PROCEDURE script with incorrect table and column references in the MS SQL Server Management Studio and using ADO.NET commands. The scripts run ...
2
votes
2answers
2k views

How to re-create the ##MS_PolicyEventProcessingLogin## principal

I'm getting a bunch of errors in my MS SQL Server logs about a missing ##MS_PolicyEventProcessingLogin## principal. I went to check the master database and yes, it is indeed missing. I don't know how ...
2
votes
3answers
3k views

Easy or Schedulable way to move data from Production to Test

What I am looking to do, is schedule a copy of data from my production database to my dev/test database. The dev/test database will be newer than the production database in terms of schema, but the ...
2
votes
4answers
12k views

How to create and send mail in SQL Server 2008?

I want to send E-mail from SQL Server 2008. What are the basic steps for that? Can you explain me if someone used this facility. Any help will appreciated. this link will helpful as commented by ...
2
votes
2answers
96 views

Extra tables are added when I create a new Database

This is a really weird problem. When I create a new DB from a script I'm getting extra tables added. These aren't system type tables but regular tables that look like they may have come from a past ...
2
votes
1answer
16k views

How to determine used/free space within SQL database files?

I normally use the following method to determine the free/used space within each file of a database: Select *, fileproperty(name, 'SpaceUsed') as Used From dbo.sysfiles This returns total and used ...
2
votes
3answers
255 views

Is it possible to have 2 or more databases active, and synchronized between them?

edit I'm testing possible solutions for database redundancy and high availability,I tested mirroring it worked fine, but lacks scalability plus there will be a lot of work in one server. Now I ...
2
votes
1answer
5k views

Running an SSIS package without the SSIS service installed

On a SQL Server 2005 instance in our DMZ, we have BIDS installed but not the SSIS service. If I have an SSIS package on that server, can I still schedule to run it without SSIS service? I tried ...
2
votes
1answer
511 views

truncate table for all db in sql server 2000

i need a script that will go to every db in server and if exsistes a table named "table1" will do truncate table table1
1
vote
2answers
50 views

Deciding on a replication strategy

We have several dozen small-medium (<1Gb) databases on our SQL Server 2008R2 (Standard Edition) server, with one or two more being created every month. The server itself is a fairly well spec'd box ...
1
vote
1answer
96 views

routine to backup ssas databases fails with: The XML for Analysis request timed out before it was completed

I have developed my own stored procedure, that through a LINKED SERVER, backups the SSAS databases according to a table value parameter. the code for the stored procedure is below. the problem: it ...
1
vote
2answers
55 views

Managing logins with Availabilty Groups

I have created a user on my primary node that has access to all of the databases in Availability Group AG1. How do I ensure that same user has the same rights on all the other replicas in AG1? ...
1
vote
2answers
83 views

How to use variables with RESTORE FILELISTONLY

Storing the result of RESTORE FILELISTONLY in a temporary table called #filepaths. IF object_id('sp_restore') IS NOT NULL drop procedure sp_restore go CREATE PROCEDURE sp_restore AS BEGIN ...
1
vote
1answer
25 views

many Servers of SQL server 2012 needs mirroring [duplicate]

I have now simply 2 SQL Server 2012. I want to configure database mirroring between the 2 servers. My questions are: How can it automatically change host of one if the other one was dropped ? Is ...
1
vote
3answers
166 views

Extracting an an integer value from an xml column

I'm just wondering how I can extract an integer out of an XML column. Currently all the digits are 4 which the below query is able to do. But the number is going to grow to 10,000's soon which will ...
1
vote
4answers
406 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
73 views

How to get the first or last row in ordered result set, depending by column value?

I have the follwoing result set from the table PUNCHREPORT EMPLID Name PUNCHDATE PUNCHTIME DEVICETYPE .................................................................. 70 ...
1
vote
1answer
1k views

SQL Server 2008 R2 Express single CPU core usage and need of upgrade to SQL Server 2014 Express

In our office we are using SQL Server 2008R2 Express which is installed in Windows server 2012. The SQL Server database is accessed by more than 60 users in network simultaneously. In recent days we ...
1
vote
2answers
478 views

multiple select query for the same tables with union [closed]

Using below query i want to find out the top number of students from each catagory(SC,ST,OBC,etc) on plus2percentage basis. eg i want top 3 students from SC catagory, top 2 from ST and Top3 from OBC. ...
1
vote
3answers
284 views

Selecting from a view shows the wrong set of columns

I'm selecting from a view in SQL Server. If I right-click on it and choose "Select Top n Rows", it runs and shows me 30 columns. If I open the view in ALTER mode (right-click, Script View As, ...
1
vote
2answers
350 views

Building A SQL table horizontally VS vertically

What is a better design principle when designing SQL Server tables. One can either add columns (ie grow horizontally) or grow it vertically (ie rather adding rows) I have a situation when there are ...
1
vote
0answers
604 views

Backup Restore Procedure error SQL Server 2008 R2

We use a stored procedure to do a backup and restore of databases as a copy function. This allows our front end users to spin up sites from pre created template databases. Lately we've been getting ...
1
vote
1answer
2k views

Trigger to audit table changes

I have created a trigger to audit changes to a table: CREATE TRIGGER [dbo].[iudt_AutoAuditChanges] ON dbo.CPTCategoryMaster AFTER INSERT,DELETE,UPDATE AS BEGIN SET NOCOUNT ON; ...
1
vote
1answer
88 views

Delayed availability of historical data when using CDC

I am using the SQL Change Data Capture feature to retrieve historical data from my tables. During testing, I noticed that when I insert/update a row and query the change data right afterwards (see my ...
1
vote
0answers
74 views

Efficient way to Add NON-CLUSTERED Index?

I have the following table, CREATE TABLE [dbo].[Products]( [ID] [int] IDENTITY(1,1) NOT NULL, [RetailerID] [int] NOT NULL, [Name] [nvarchar](255) NOT NULL, [Price] [float] NULL, ...
1
vote
1answer
242 views

Transaction Replication Without Snapshot

So I have looked up many other people trying to get Transaction Replication Without Snapshot working and I'm stuck. I've followed what everyone has said so I don't know what I'm missing. Prod server ...
1
vote
2answers
5k views

How Can I Convert SQL Server 2012 Version 11.0.3000.0 to SQL Server 2012 Version 11.1.3000.0?

I have SQL Server 2012 with version 11.0.3000.0 . I need upgrade my version to SQL Server 2012 SP1 because I need install Cumulation 4 in Sql Server 2012 Cumulative Update 4 for use PowerPivot in ...
1
vote
2answers
137 views

Linked Server Has Run Out Of Memory

So I have a stored procedure that calls an AS400 Linked server. Now, the stored procedure will execute successfully. However, it is used in a SQL Agent Job and each time the job runs, it gives the ...
1
vote
2answers
80 views

Profiling feature for SQL server 2012

I'm using SQL Server 2012 to develop php/web applications. On my development machine, I have SQL server also. The php codebase is version controlled with git. The various applications we have (and ...
1
vote
2answers
212 views

What are the primary architectural differences between the backup formats of some of the more common RDBMS' and what advantage do they serve?

Of the systems with which I am familiar, I have noticed that SQL Server's native database backup format is binary and proprietary. PostgreSQL and MySQL allow for a simpler approach, dumping the ...
1
vote
2answers
472 views

How to give the least permissions for CRUD-managing and running SQLServerAgent jobs as well as Maintenance Plans?

Follow up to my question "What's the owner of SqlServerAgent job for?" Basically, I am trying to understand how to create a user-login with least privileges for CRUD-maintaining SQLServerAgent jobs ...
1
vote
2answers
441 views

What's the owner of SqlServerAgent job for?

What is the possible use of owner of an SQL Server Agent job, I wonder? Removed, and left it blank and the job still succeeds
1
vote
1answer
1k views

Any way to import-export-migrate-save-restore a maintenance plan without having SSIS installed (and running)? [duplicate]

I am having dozens of MSSQL Servers 2012 R2 on Windows Server 2008 R2 with similar setup, configuration (in virtual machines) in production. Neither has SSIS installed. I have to similarly maintain ...
1
vote
1answer
340 views

Approaches for Real time copy of database on same SQL Server instance

I have a draft of requirements that look like this: Production database should be copied in real-time to "Pre-prod" database The Pre-prod database should be available to read and update It should be ...
1
vote
2answers
1k views

Optimizing removal of duplicate rows from recursive CTE query

I need to write a recursive SQL query to fetch multiple projects together with their lineage from the following table: CREATE TABLE #Project ( Name VARCHAR(10), ParentName VARCHAR(10) ) INSERT INTO ...
1
vote
4answers
1k views

SQL Server Page Life Expectancy sharp drop

I'm trying to put my hands on the reason this SQL Server slows down sporadically. There are no patterns detected so far. It's a SQL Server 2008 R2 running on a Windows Server 2008R2 VM on top of ...
1
vote
2answers
1k views

Moving data in multiple tables from old database to one table in new database [closed]

I have two SQL Server 2008 databases. One is for my old application (full of data) and the other is for a complete re-write of my application. I want to migrate the data, but I have no idea how to ...
1
vote
3answers
728 views

How can I get a list of tables contained in a database diagram?

I need to get a list of the tables contained in a diagram in SQL Server. How can I do it using an SQL script? I don't need a list of tables in the database, but the list of tables contained in a ...
1
vote
1answer
333 views

Cannot shrink transaction log

Bit of a headscratcher here. I have a db that has less than 1GB of data, but a 40GB log file. Transaction logs are backed up daily, and there is not a lot of activity on this database; approximately ...
1
vote
3answers
136 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
2answers
6k views

Splitting a large table to improve performance

This is a follow-up to an earlier question. I have a SQL Server 2008 R2 Standard server, that holds a single database, which itself has almost nothing except a large table. The table is 100+ million ...
1
vote
1answer
124 views

CTE query doesn't print the right structure?

I have this table which represents hierarchy : childID parentID NAME siblingOrder 1 1 a 0 212 1 ab 1 112 ...
1
vote
3answers
2k views

Import .bak file in Microsoft SQL Server 2008 Service Pack 3 [duplicate]

I have a backup of my database as a TestDatabase.bak file but I am unable to restore it. When I try to restore I receive the following error message in SSMS: RESTORE could not start database ...
1
vote
3answers
952 views

Restore database - maintenance plan task

I need to schedule a task that restores a database once a week from a backup. I have setup maintenance plans for backing up databases (Management > Maintenance Plans) but cannot find out how to make a ...