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
0answers
34 views

SMO Not Scripting DB Objects

I have a PowerShell function included in the allusersallhost profile. It is basically scripting linked servers. When I execute the function from a PowerShell session, it scripts the linked server ...
0
votes
0answers
21 views

Query to get result in Excel file [duplicate]

The following query gives me the error Incorrect syntax near 'OUTPUT'. SELECT * FROM dbo.sales ; OUTPUT USING 'Driver=Microsoft Excel Driver (*.xls); DBQ=c:\\test\\sales.xls; READONLY=0' INTO ...
1
vote
2answers
42 views

Concatenate Columns in Stored Procedure [duplicate]

I have a stored procedure which returns a weekly result from input parameters start date and end date. I am getting multiple rows in the result. Requirement: I want to add the results of columns in a ...
6
votes
1answer
259 views

Cannot execute as the database principal because the principal “dbo” does not exist [duplicate]

I restored a backup of a database from SQL Server 2008 R2 to SQL Server 2012. When I try to access a particular page of my application, I get this error: Cannot execute as the database principal ...
3
votes
1answer
41 views

SSMS 2012 mutiple query windows using same session

I wonder if it is possible to connect multiple files or query windows in SSMS to one session? The reason is that I want to use local temporary tables that are created in one file/query-window in other ...
0
votes
1answer
33 views

SQL Azure Migration Wizard - Duplicate Primary Key

Just did a test at migrating a 120gb database onto RDS using SQL Azure Migration Wizard Because we can't afford any downtime for "just" a test we ran the tool on the live database (meaning data was ...
7
votes
3answers
320 views

Find the identity of the client firing a query in SQL Server without using triggers?

I'm currently using Change Data Capture (CDC) to track data changes, and I wish to track the host name and IP address of the client submitting the query that made the changes. If there are 5 different ...
0
votes
1answer
22 views

See SQL Server Reporting Services Reports without logging in?

I have installed SQL Server 2015 with SSRS and I have some reports I need to run, but in order to access http://reportsserver/Reports I need to start Internet Explorer in administrator mode. This is ...
-1
votes
1answer
35 views

SQL query is in “Execution” status and it keeps on running

I try to run a simple query in SQL 2102 select count(*) from cab_details , but it keeps on executing. If i restart the sql service , the result is shown in just one second. (Count is around 250,000 - ...
3
votes
2answers
55 views

Is is possible to recover a database from the 'raw' files (.mdf and .ldf) of the old server to a new SQL Server instance on a new server?

I have a client that has POS software called Restaurant Pro Express (RPE) from www.pcamerica.com. RPE uses a SQL Server database. Their old POS server had a hardware failure, but I was able to attach ...
15
votes
2answers
176 views

Does CPU utilization affect the cost of foreign NUMA access?

Scenario Let's assume I have a SQL Server with 4 sockets with each 1 NUMA node. Each socket has 4 physical cores. There is 512 GB of memory total so each NUMA node has 128 GB of RAM. A key table is ...
1
vote
2answers
285 views

SQL Server 2014 SP1 Setup Freezes Removing Temporary Files On Windows 10 x64

I want to install SQL Server 2014 Enterprise Edition with Service Pack 1 on Windows 10. But when I try, the installation stops every time at the part the screenshot below shows, and I wait for hours. ...
1
vote
0answers
28 views

Speed of Split Database vs ODBC with SQL Server vs ODBC with Azure Cloud

I would like to be able to host my data either in the cloud or in SQL Server, as having all my data in one Access file just doesn't seem the most secure to me (or am I wrong?). My forms contain many ...
-2
votes
2answers
96 views

Cannot find one or more components. Please reinstall the application

I am getting this error in Windows Server 2012 with Visual Studio 2012 installed trying to open SQL Server Management Studio 2012: Cannot find one or more components. Please reinstall the ...
1
vote
1answer
46 views

AlwaysOn Manual failback not working correctly

I've set up a small fail over cluster using AlwaysOn in SQL Server 2014 and Windows 2012R2. The cluster (SQL-CLUSTER-DEMO) just contains 2 SQL nodes (SQL-01 [Primary] & SQL-02 [Secondary]) and a ...
1
vote
0answers
30 views

Howto measure improvement after create and move new filegroups in SQL Server

How can one measure the (hopefully) positive effect of moving couples of indexes to a different finegroup, so to say seperate them from the data filegroup, and move this filegroup to another LUN in ...
5
votes
1answer
77 views

Detect if two time periods overlap

I have an HR system and I need to detect if a new leave (time off) request conflicts with an existing one. I have written code to do this based on the entire day; I now need to do the comparison based ...
0
votes
1answer
27 views

Referring system views and functions in production functions

I am using the following system objects in a stored procedure in order to build dynamic T-SQL statements: [sys].[objects] [sys].[parameters] [sys].[dm_exec_describe_first_result_set] [sys].[columns] ...
2
votes
1answer
22 views

Overwrite event - data from SQL Server to MySQL

In MySQL is it possible to execute an update query with values selected from external SQL Server database? I'd like to execute every night a timed query, which overwrites some data in MySQL with data ...
2
votes
1answer
43 views

Capturing sp_executesql statement in sql profiler

After catching some data in a SQL Profiler session, I can almost always see a second entry of type RPC:Completed for each query using a sp_executesql statement. I know that this is done to create ...
3
votes
1answer
88 views

ASP.NET & SQL Server 2012 timeouts once a month

We have an intranet site which works fine, except one day a month. There are slow queries, unoptimized tables, tables with ~8 million records, etc. but daily usage is fine, although some ...
0
votes
1answer
29 views

How to send an email with embedded values

I need to do a stored procedure that sends an email when a value reaches 100 with this wording in the body: "100 daily file downloaded from the user:USERID" where USERID is the user that reached 100. ...
4
votes
2answers
238 views

How to extract pipe-delimited data using BCP?

I tried the following command USE <DBNAME> SELECT 'exec master..xp_cmdshell' + ' ''' + 'bcp' + ' ' + TABLE_CATALOG + '.' + TABLE_SCHEMA + '.' + TABLE_NAME + ' out' + ' D:\' + TABLE_NAME + ...
2
votes
1answer
22 views

Problem with “not” in full text search

I don't understand why I'm getting these results with my full-text search query in SQL Server 2014. The following query returns results with "Supervisor" in the Title field and "Tokyo" in the ...
14
votes
1answer
104 views

User-shared queries: Dynamic SQL vs. SQLCMD

I have to refactor and document a number of foo.sql queries which will be shared by a team of DB tech support (for customer configurations and things like that). There are types of tickets that come ...
9
votes
3answers
752 views

How to answer why suddenly we need indexes or query needs to be changed

I am junior dba with 3 years of experience. Our job is to fine-tune queries or advise developers that particular code should be re-written or indexes are needed. One simple question the dev team asks ...
2
votes
0answers
29 views

Connecting to SQL Server using PHP, ODBC, and Windows authentication [migrated]

I'm trying to use PHP to connect to an ODBC data source using Windows authentication. I can connect just fine to the server in SQL Server so I know it's running. When I try to run the command ...
4
votes
2answers
96 views

Reducing impact of SUM(DATALENGTH()) over linked server

I have a query that reports back to me how much time elapsed for records to be added. I also in this query track the size of an image that was added to the database. From what I can see it looks like ...
3
votes
1answer
24 views

Error 7399 when the Access file has a password

I'm trying to create a linked server to access an old MS Access database (.mdb file) on SQL Server 2012, but I always get the error 7399 (authentication denied). So I tested with another mdb file that ...
2
votes
1answer
53 views

Index is seeked and scanned - is there a risk for seek to fail after modification?

I have an index that has been seeked 230.000 times and scanned 130.000 times. In order to improve the queries that have scanned, because they use an additional column I guess, I would like to change ...
6
votes
1answer
554 views

Dropping a large table

On our production db there is a table 180 GB, around 2 millions records, I want to re-create it as a new empty table in a new filegroup and delete the existing table. What is the best practice to ...
2
votes
1answer
66 views

How do i reverse this SQL Query Script, I am trying to remove filestream from my SQL 2014 Server

I am trying to remove filestream from my database, so I have to do the following I would like to know how to remove the following: ALTER TABLE AMGR_Documents_Tbl ADD UId uniqueidentifier ROWGUIDCOL ...
1
vote
1answer
31 views

SQL Server: modify data file size and shrink

When I try to modify the Database File Size, it shows this error. Specified size is less than or equal to current size I tried this query: Alter database [dbname] modify file ( ...
1
vote
1answer
18 views

Logins mapped to dropped database sql server

I was told to delete the logins that are mapped to a database ABC but unfortunately the database ABC has been dropped and no backups exist. Is it possible to find the logins that WERE mapped to ABC? ...
11
votes
2answers
746 views

Why does my WHERE clause benefit from an “included” column?

According to this answer, unless an index is built over the columns which are used to restrict, the query will not benefit from an index. I have this definition: CREATE TABLE [dbo].[JobItems] ( ...
3
votes
0answers
68 views

Creating MSSQL Performance Baseline Monitoring

In order to get an overview and compareable data my current task is to create a performance baseline to get some figures about the different productive sql instances. My thoughts are: I want to ...
1
vote
1answer
43 views

Database design for a car dealers website

I am creating a new website for all the car dealers in my region to show their cars on and i need your opinion on the database I have created because I have some doubts. For instance, is it best to ...
6
votes
1answer
75 views

Size of individual transactions in log file

is there a way to find out the size of transactions from the transaction log by looking at the log file in SQL Server 2008? I do have an unexpected bloat of my logfile from some maintenance jobs which ...
7
votes
2answers
99 views

Most efficient way to generate a diff

I have a table in SQL server that looks like this: Id |Version |Name |date |fieldA |fieldB ..|fieldZ 1 |1 |Foo |20120101|23 | ..|25334123 2 |2 |Foo ...
2
votes
0answers
82 views

Why does SQL Server Management Studio crash?

When I open SSMS I get this message: SSMS - SQL Server Management Studio has encountered a problem and needs to close. We are sorry for the inconvenience What can I do? The issue persists ...
3
votes
1answer
47 views

SQL Server 2014 Availability Group failed

I have 3 servers on VMware workstation: Win 2012 R2 as ADDC -Cluster service. Win 2012 R2 as SQL server primary replica . Win 2012 R2 as SQL server secondary replica (auto fail-over). My ...
3
votes
0answers
100 views

How to manage hundreds of SQL jobs? [closed]

I work in Microsoft SQL Server database and I have to monitor and manage hundreds of SQL Jobs to see which job will execute on what day and what time. I also have to troubleshoot the failure of the ...
5
votes
3answers
165 views

Virtualize SQL High CPU

This is a client environment which needs significant overhaul so all I am trying to do is slow the bleeding. Situation CPU is getting crushed, often 80% or higher utilization VMWARE 5.5, Windows ...
2
votes
1answer
49 views

Does a database backup include all files? [closed]

If I have two files in my database (mdf & ndf), when I do a backup of the database with the statement: backup database mydb; are both the two files are backed up?
0
votes
1answer
22 views

Is there a query to see if all of my logins and password are moved during migration from SQL Server 2005 to 2008R2

I am trying to migrate my database from SQL Server 2005 to 2008 R2 test, I did follow back up and restore method to migrate the database, and I ran the QUERY provided by Microsoft to transfer logins ...
1
vote
0answers
17 views

SQL Server: error 7303 (architecture mismatch)

I've searched a lot, but I still didn't find out a solution. I have to create a linked server to get the data from a mdb file (MS Access). I use the SQL Server 2012 Express x64 on the Windows 8.1 x64. ...
1
vote
2answers
52 views

Turning a multiple row resultset into columns with multiple rows [duplicate]

I currently have a resultset that looks like this: Title Value Start Time              1998-01-04 01:38:00.000 End Time                1998-01-04 01:43:00.000 Product Name         ...
5
votes
2answers
118 views

Why scalar valued functions need execute permission rather than select?

I am wondering why, for scalar valued function, that I have to grant the user to execute rather than just a select? meanwhile a table valued functions works just fine with only select permission or ...
2
votes
0answers
29 views

SQL Server Multi Tenancy Setup

What is the best way to use Multi Tenant Database Architecture when all of the "Tenants" will be from the same company? We are going to be using AWS and SQL Server for our backend system. We ...
2
votes
1answer
55 views

Shrinking Databases in a maintenance plan [duplicate]

Everything I've heard (including from Microsoft) says you should never shrink a database. Yet a software vendor (Symantec) is telling us to do DBCC SHRINKFILE on the SQL 2012 databases and logs ...