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

SQLcmd error 'Failed to initialize sqlcmd library with error number -2147467259'

I'm trying to update some maintenance plans to make use of the Ola Hallengrens IndexOptimize, but also mail the result of the operation using sp_send_dbmail. Old T-SQL: declare @indexQuery ...
17
votes
2answers
154 views

Optimization issue with user defined function

I have a problem understanding why SQL server decides to call user defined function for every value in the table even though only one row should be fetched. The actual SQL is a lot more complex, but I ...
1
vote
0answers
31 views

Schedule data from instance to instance have I maxed out tableDiff

We have a process which uses tableDiff. From one SQL Server 2008 R2 instance to another identical instance. It has worked very well for a long time! I have a situation where one table now has ...
0
votes
0answers
29 views

Retrieving a record for the last date received and returning the value of another column in that row

I have the following query which is returning me total number of expected records : select a.New_FirstName + ' ' + a.New_LastName as 'Account Name', a.New_MPRNNumber,MAX(b.New_readdate) as 'Last SC ...
0
votes
1answer
29 views

SELECT w/ INNER JOIN Query on Optional Columns

I have five tables: File2, Branches_of_Study, Schools, Education_Establishments, and Certificates. File2 is the transaction table with all the other tables as reference tables. File2 is all about the ...
6
votes
1answer
63 views

SSDT Schema Compare fails when comparing my DB Project to my Azure Server

I have a SQL Database project that I have built our enterprise DB on. It has deployed several times on internal and AWS hosted SQL servers using SSDT's Schema Compare tool. The problem when I post ...
0
votes
1answer
13 views

Unable to delete a SQL Server 2012 publication

I've set up a transactional replication for two databases, let's call them A & B. Replication for the database A worked just fine and I was able to delete it afterwards without any issues. ...
1
vote
1answer
53 views

What connection string to use to connect to network server?

I have a database on my computer running on SQL Server Express 2014, and I'd like other computers connected to my network to be able to connect to it using a C# program I wrote. I've done the ...
7
votes
3answers
669 views

How to insert a large amount of records to the database in a short time?

I have to insert a bunch of records(500,000) to the database at once, using the fastest way. I've tried inserting 1,700 records at once but it took twenty minutes!! I am using SQL-SERVER, and C#. ...
2
votes
1answer
33 views

reading content of master database at a different server

I have a query for example select * from sys.databases select * from sys.configurations I believe this information is stored at master database. I would like to have a look at configuration ...
0
votes
3answers
54 views

Query for total downtime of site using datestamps and status columns

what want to find the total downtime for a site. I'm thinking I can subtract the 'down' DateStamp from the following 'up' DateStamp. then add the totals together for all downtime. I want to get a ...
0
votes
1answer
41 views

Sql Server job runs forever after server restart

One of our ETL servers had to be restarted and a job was in the middle of execution. It was on the 2nd of 6 steps and now the job agent shows that it has been running for 15 hours back on step 1. ...
0
votes
0answers
26 views

Sync two SQL Server databases

So I've got a hosting package from hostgator with an MS SQL database and a local SQL Express 2012 database running. I'm trying to investigate syncing the two together, two-way syncing, and I'm unable ...
6
votes
3answers
104 views

Sql Server Service Pack Update Notifications

Is there any option in Sql Server to enable notifications from Microsoft in a way that it sends us emails every time a new service pack is released? I have multiple servers with different versions of ...
1
vote
0answers
28 views

Processing data while keeping frozen frontend database online

What is the best approach at having a "frontend" database online and working, while processing and generating new data in the back? I have an scenario that some tables and even whole databases data ...
2
votes
2answers
46 views

Blocked Process Report -two updates causing a long block

I have a .NET application which is getting SQL update timeouts and I believe that some sort of blocking/locking is taking place which is causing this. I have ran a blocking process report on the ...
0
votes
2answers
29 views

SQL Server database backup and saving at the same time

What will happen when is running differential backup on SQL Server 2012 and some application is trying save data to table at the same time?
1
vote
1answer
37 views

Viewing Type Of Lock Being Used T-SQL - Update Lock Query Issue

I am looking for a way to determine whether SQL will take a shared lock or an update lock. Take these three queries. I believe in that in theory: Query one will take a shared lock on the pk, due ...
0
votes
1answer
36 views

SQL Server Database going into suspect mode after bulk insert and delete

I'm working on an application that does a bulk copy of data from one table to another within the same database (using an Insert... Select) and then deleting the data from the source table. In ...
1
vote
1answer
36 views

Computed Columns Or Views - Database Table Design

I want to store values in certain units along with their corresponding conversions. So for example, there would be following columns DateTime Millimetres Centimetres Metres For a ...
-1
votes
1answer
66 views

CTE Expression not working

I am trying to get the employee hierarchy as output with empLevel indicating the reporting layer. However, my query returns only one row i.e. The CEO of the company while it's supposed to return all ...
1
vote
1answer
42 views

Backup SQL Server with VMware

The VMs I run SQL Server on are regularly backed up by the VMware backup tool. I would prefer not to use this backup solution but I have no choice but to cope with it. The problem I've come up across ...
1
vote
0answers
68 views

How SQL Server translate special characters like '$' and '\'

I write a query like that: SELECT $ a, \ b, -- also for other currency symbols like `€` $ 1 c, $ . d, $ .'e', -- test space 1 + $ f, ($) + 1 g, -- test ...
1
vote
2answers
45 views

With LocalAdmin become sysadmin SQL Server

I am a local Admin on my machine. Same old thing, my account wasnt added when SQL Server was installed, and I don't want to have to reinstall SQL Server. I went through this blog and it worked until ...
1
vote
1answer
38 views

Setting query to run as a stored procedure and email the results [closed]

I have the following query: select COUNT(CASE WHEN New_accounttype = 1 THEN New_AccountType ELSE NULL END) as 'New Connections' , COUNT(CASE WHEN New_accounttype = 2 THEN New_AccountType ELSE NULL ...
0
votes
1answer
30 views

trouble creating a stored procedure to print out values for each day of week

I am having difficulty in understanding how to get this working correctly. I am trying to have create a stored procedure that is run automatically on a sunday and will get the data for the previous ...
2
votes
2answers
100 views

Blocked Process Report SQL Server 31 hour duration

I have an application (.NET EF 6 ) which is getting timeouts when submitting/reading data from the database. Whilst trying to diagnose the problem I used Blocked Process Reports from SQL server ...
2
votes
2answers
57 views

How to pass parameter in select query(In with clause) and not in where condition in SQl Server SSIS Package?

I want to pass a parameter (@date1) in my SSIS OLE DB Source so I created a variable and I tried to pass the parameter using '?' but it's showing 'Syntax error, permission violation or other ...
1
vote
1answer
22 views

SQL Server pivot filter underlying tables by aliases specified in view

I have table structure as follows: CREATE TABLE [dbo].[Test] ( [ID] [int] IDENTITY(1, 1) NOT NULL , [ProductID] [int] NOT NULL , [CountryID] [int] NOT NULL , CONSTRAINT [PK_Test] PRIMARY ...
2
votes
0answers
18 views

Locks while stream reading and deleting/inserting involving the same tables?

I have a question regarding a potential block/lock situation: I am reading data using a select command, which is then modified externally and uploaded to a temporary table. A stored procedure will ...
1
vote
1answer
30 views

Distribution database(recovery pending)

Firstly I was trying to create a distribution database and I succeded at first but since I checked the box to configure SQL server Agent to start automatically, the last step of configuring ...
2
votes
2answers
34 views

Safest way to uninstall the previous SQL Server versions

I'm trying to free up some space in my Testing SQL Server. It has SQL Server 2005, 2008, 2008R2 and the compact or express edition. Since I only use lately the 2008R2 version, its not clear for me ...
2
votes
3answers
97 views

Bulk Insert - (0 row(s) affected)

I am trying to import a .CSV file into a mssql table using bulk insert (Although I am open to other methods). I have a bulk insert sql statement but it says (0 row(s) affected) when I execute the the ...
1
vote
0answers
32 views

Good SQL Agent job wrapper… TRY/CATCH, Custom logging. (Review and provide input)

I'm looking for input on a small snippet of code i wrote. We use SQL Agent jobs to prepare big databases from production, before we ship the to test-environments. To get better feel for duration of ...
4
votes
1answer
90 views

Should I use a subquery to help SQL Server find the correct plan

I have a query (which has components which are built on the fly depending on the selections a user makes in the interface) that runs in SQL Server 2008-R2 that runs in about 100 databases. Users are ...
1
vote
1answer
49 views

How to interpret this XML plan fragment?

I am looking at the query plan produced by SQL Server 2008 R2 and I'm not sure I'm interpreting it properly. Examples: <RelOp NodeId="2" PhysicalOp="Sort" LogicalOp="Sort" EstimateRows="1" ...
4
votes
1answer
132 views

Moving Transaction Data To Another Database For Reporting Purpose

We got a requirement from our developer group, to do the followings: Frequently (every 30mins) move the transaction data out of live database to another database Secondary database will be utilize ...
2
votes
2answers
68 views

SQL Server varbinary column modifying inserted data

We have a table in our database for storing photos, the datatype of the actual photo data is varbinary(max). When inserting a photo from the application, the data is correctly stored and the photo ...
1
vote
0answers
49 views

Query execution taking long time

SELECT sqltext.TEXT, req.session_id, req.status, req.command, req.cpu_time, req.total_elapsed_time FROM sys.dm_exec_requests req CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext select ...
4
votes
1answer
112 views

Preventing full backups for unmodified/slightly modified databases

Is there a way to either: ensure that unmodified databases are skipped during SQL backups, or even better choose between DIFF or FULL backup depending on the percent database changed since last ...
3
votes
1answer
47 views

Why is the secondary selective index not used when the where clause filters on `value()`?

Setup: create table dbo.T ( ID int identity primary key, XMLDoc xml not null ); insert into dbo.T(XMLDoc) select ( select N.Number for xml path(''), type ) from ( ...
0
votes
1answer
41 views

Query trans log or tempdb?

New DBA, all of our databases are SQL 2005. All of our servers run in Simple recovery mode. I work for a school district, where we report student attendance to the state. I run a query to fix ...
4
votes
1answer
28 views

Doing a select based on a count(), a date range, and string match

I'm going to do my best here. I Have a list of citations that were written and a and some information about those citations. I need to select the citations that have been voided in a given date range ...
1
vote
1answer
32 views

Restricted user on my local SQL Server database?

I started working at a new job and when I opened up SSMS and tried connecting to my local DB (by connecting to ".") I got a cannot connect message. I was finally able to connect to my local DB by ...
1
vote
2answers
46 views

SQL Server Auditing is not available in Standard editions?

If the Auditing option is not available in SQL Server 2008 R2 Standard edition, then why I still see it under the Security object in SSMS? After reading online, it seems that my option is to use the ...
5
votes
2answers
69 views

Does SA account need to be called “SA” or can I rename it safely?

We have some applications on our network (from before my time) that use SA account in their SQL Server connection string. It's hard-coded in the source code, and for whatever reason, we can't change ...
1
vote
4answers
75 views

How to select first row from a join that returns multple rows on the primary key

This is related to this question: Joining multiple tables results in duplicate rows I have two tables that I am joining. They share a key. The person table has one name per primary key but the ...
1
vote
1answer
34 views

Access Data stored in SQL Server

I'm currently working on a project to convert our Access Apps to store the table data in SQL Server. Using SSMA to migrate the data results in the foreign keys and Look-ups work as expected in ...
6
votes
2answers
259 views

SQL column name search

I'm using SQL Server Management Studio. I have a massive database and I want to search for column names that might be able to help me figure out what I need to join on. Is there a tool or other ...
0
votes
2answers
66 views

Changing sa password

I'm trying to change the password of the sa account using SQL Server Management Studio 2012. I've followed the steps below but the password is still the same. Login into the SQL Server Management ...