The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [sql-server]

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag, like sql-server-2016, since it is often relevant to the question.

Filter by
Sorted by
Tagged with
0
votes
1answer
47 views

Agregate data from multiple rows in one row [duplicate]

I have a SQL server DB for credit card processing system with 5 Tables MerchantContract PaymentKey NVARCHAR(50) ProcessingID INT DealTrace Status NVARCHAR(250) Tag NVARCHAR(MAX) ...
0
votes
0answers
164 views

how to convert a profile trace into extended events?

I was having a look at this site: Convert an Existing SQL Trace Script to an Extended Events Session but still struggling to make the trace file below to work as an extended event. -- Create a Queue ...
0
votes
1answer
68 views

Analysis services access through MS Excel- permissions issues

I have an instance of Analysis Services set up with my cube and am attempting to access it through MS Excel. This works for one of my accounts but not for another. My goal is to get the second ...
0
votes
1answer
37 views

SQL DATABASE ENGINE permisions

I want to deny query for insert,update,delete,alter in database engine only? is there a way to do that ? Because I have an application that uses the SQL database server and has a lot of users that ...
0
votes
1answer
29 views

Remove some auto created indices from Entity Framework?

I'm using Microsoft's Entity Framework. It automatically creates indices for every foreign key, but in many cases, I can see from the index stats that these are never used for reading - they are only ...
0
votes
1answer
73 views

Help needed in creating a SQL statement containing four joins

Please help. Given a studentID and a TagNumber i want to get the UserID related to that TagNumber. The difficult condition is that TagNumbers can be duplicate within a Users table. So we can pinpoint ...
0
votes
1answer
34 views

Best way to get the latest Identity when inserting through View

I am using View and View trigger to insert data into multiple tables. In this case, how can I get the inserted ID of the specific table? I was using IDENT_CURRENT but it's not recommended. How can I ...
0
votes
1answer
3k views

NT SERVICE\MSSQL$SQLEXPRESS user cannot be found when added to network drive

For SQL Server 2016 Express, I would like to backup/restore directly to/from network storage I have mapped to drive S:. SQL Server Express runs under the (virtual?) account NT SERVICE\MSSQL$SQLEXPRESS ...
0
votes
0answers
595 views

SQL Query to calculate total time worked and total distance travelled

I am trying to write an SQL Query which calculates the Total Time worked and Total Distance Traveled by a Driver for each date. The StartOfDay is the MIN(LogDateTime) WHERE EventCode = 1 The EndOfDay ...
0
votes
0answers
26 views

Help Interpreting a group by clause

I have the following Group By clause: Group By Grouping Sets (a, (b, Rollup (c, d)) ) My thought process is Grouping sets ( a ) Union All Grouping sets( (b, Rollup (c, d) ) ) Then expand the ...
0
votes
1answer
107 views

Trigger on replicated DB

If I have database db1 with schema sch1. I want to create another schema sch2 which will be used by different application and the tables in sch2 will be populated from tables in sch1. So my approach ...
0
votes
1answer
626 views

how to find out the next time a job is scheduled to run in sql - in real time and even if the job has never been run before

I have a very similar question here but the problem with that question/ answer is that it does not work for all situations. for example, for the jobs that I have just created and have not been run as ...
0
votes
1answer
466 views

Database design considerations for unused columns with every table has same schema

I am a web developer so I don't know a lot about databases. The company I joined recently has a very mature Desktop ERP built in .NET and SQL Server, they are providing services to huge corporate ...
0
votes
1answer
28 views

Updating and/or inserting several rows in the same SQL statement

I am implementing an account "ability" type thing - a users account is given the abilty to do one or many things in the system, like (simple examples) cancel orders or pay invoices. I have a table ...
0
votes
1answer
74 views

SSIS: Import Excel file to SQL Server

Is there a Excel version for this article? I have been searching for this past days but there is no luck. https://www.simple-talk.com/sql/ssis/ssis-basics-introducing-the-foreach-loop-container/
0
votes
0answers
2k views

pros and cons of partition or not-partition this sql server table that is highly hit?

I have a table that is highly hit on my database. this table has 370,370 records. when I run the following select: select [ImageSize] , the_num = count(*) from [dbo].[ProductImages] group by [...
0
votes
0answers
45 views

Linked Server directly to database

Say I have a query like this: select * from openquery ([linkedservername],'select * from [databasename].dbo.person') Is there a way of omitting [databasename].dbo.? I have an enormous query I want ...
0
votes
2answers
37 views

SQL server after RAID problems

We had a SQL server die due to some RAID problems. We sent the machine out to a data recovery company and they are able to recover the .MDF and .LDF files from the drives. Will I be able to use ...
0
votes
1answer
49 views

Deselect CPU in affinity setting for OS Only use?

A memory recommendation is to reduce MaxMemory by 4GB or 10% of RAM (equally divisible by cores) to dedicate that memory for the OS. Most questions on CPU affinity deal with splitting them out ...
0
votes
1answer
59 views

Query to Find Out How Many Days Until Database Is Full

Using my central MDW database I am trying to make a query that will be able to calculate the number of days until all my databases free space will be full. Currently the query I have is overly ...
0
votes
0answers
729 views

SQL query runs fast on local computers but slow on production server

I am running a fairly basic query on my local development machine which runs almost instantly. However on the server its taking around 3-4 seconds to return results. I have ran Client Statistics on ...
0
votes
1answer
201 views

Call to sysmail_delete_mailitems_sp keeps deadlocking

I run SQL Server 2012. I have a maintenance job that runs every night. At the end of the maintenance, I do some cleanup and call this: Begin try Exec msdb.dbo.sysmail_delete_log_sp @logged_before = '...
0
votes
0answers
89 views

What is the VERSIONING_COMMITTING wait type in SQL Server 2012?

I have a fairly large SQL Server 2012 database in an availability group that experienced performance problems for about an hour, with the bulk of the wait in HADR_SYNC_COMMIT (waiting for synchronous ...
0
votes
1answer
40 views

Mapping 5 columns to 1 (ID, dimension) table without 5 joins?

I'm using survey monkey's API to dump survey data into a SQL data warehouse. So I'm dumping response data into a table 'resonses' thusly: survey_id, Q1, Q2, Q3, Q4, Q5 survey3944, 848948344, ...
0
votes
2answers
412 views

Always On Listener Behavior - DBs removed from group

We have multiple multi-site always on failover cluster instances in our env. We have an enforced internet outage being imposed on us and at the time the link between the data centers will be down for ...
0
votes
0answers
170 views

Hidden Index on a table [duplicate]

I am running into an issues with locating index In SSMS, if I expand Users>Indexes, I do not see an index named "_dta_index_Users_5_1466188719_88410000_K1_K6_K2_7_10_11" But I can see a statistics ...
0
votes
1answer
44 views

Better way of re-arranging the indexes for better performance

I ran a script to find overlapped and duplicate indexes for a database. Below is the sample screen for the above said. Please advise how can I arrange them or what should be the guidelines to make a ...
0
votes
1answer
98 views

Data Modeling constraint issue

Can someone help me with this school question? I have this data model shown below: here is the question: You are modeling an emergency communication system used to contact teachers in case ...
0
votes
0answers
62 views

NULL value in query_plan column from the sys.dm_exec_query_plan DMV [duplicate]

I've written a query to return data from the sys.dm_exec_query_plan DMV, but for a specific stored procedure the query_plan column which should contain a link to the XML version of the plan is NULL. ...
0
votes
0answers
3k views

OraOLEDB.Oracle not showing up in Providers in Linked Server

Im trying to link the Oracle database to our SQL Server database. However OraOLEDB.Oracle is not in the Providers list on the Linked Servers. I have installed Oracle Database Client (12.1.0.2.0) for ...
0
votes
0answers
2k views

SQL 2016 Installation Error

I am trying to install sql 2016 standard on a windows server 2012 standard edition, and I am running into an odd error, hopefully someone can point me in the right direction. I am getting account ...
0
votes
2answers
368 views

INSERT INTO SQL Server : Linked Server without specifying database in semi-fully qualified name

I have a server called DEV, a database called Nus12345, a linked server called SnapshotDev, a schema called Snapshot, and a table called SnapshotPersonEmployee. On the DEV server, there are many ...
0
votes
0answers
794 views

Fastest way to shred large xml data into a table [duplicate]

I have a nightly process that shreds XML data from a 17 million row table (120 GB) into another table, it takes about 3 hours and inserts about 1.5 million records. I currently do a complete drop ...
0
votes
1answer
43 views

SQL Server Management Studio - Processor counters for different sessions do not add up

In SQL Server Management Studio, I have two sessions. The workload for each session is: Session 1: while loop to select top items from one table; Session 2: while loop to update statistics of ...
0
votes
1answer
36 views

SQL Server - Why does importing lots of columns with few rows takes way longer than few columns with lots of rows?

I am using the import wizard in SQL Server 2014. When I import a text file with 40 columns with 1 million row it is pretty fast. On the other side when I am importing a few rows with 268 columns it is ...
0
votes
2answers
411 views

Unique key constraint violation not escalated to parent stored procedure

I have a stored procedure which calls 2 nested sub procedures. For Example, MyProc BEGIN BEGIN TRY BEGIN TRAN EXEC UpdateProc EXEC InsertProc COMMIT TRAN END TRY ...
0
votes
0answers
54 views

TCP Provider Issue [duplicate]

Error : TCP Provider: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to ...
0
votes
2answers
1k views

Can connect using SQL Server Management Studio but cannot ping or via program

I have a remote SQL Server: myremotedb.myremotedomain.gbl. I could connect to it from another server myserver.myareadomain (not in the same domain) using SQL Server Management Studio without problem. ...
0
votes
0answers
50 views

Exclude a Variable from getting logged in a CheckPoint file

I have an SSIS package in SQL Server 2014 which uses checkpoint to handle the cases where it needs to be run after a failure. There is a variable in the package that I want to be set to 0 whenever the ...
0
votes
1answer
97 views

Howto transfer tracefile into a trace table without loosing the sort order?

I have traced some data into a trace table into Sql Server using the Profiler GUI. This table has the following structure: It contains the SQL statements as well as execution plans in the TEXTDATA ...
0
votes
1answer
132 views

Database Log 3 times Data File [duplicate]

I have a set of database on full recovery model, my backup schedule looks like this: 1 Weekly Full Backup 1 Daily Log Backup Full backups are about 10GB, log backups are about 500mb per day. What ...
0
votes
1answer
149 views

sql auth vs nt auth in SQL server

Ok, so everything I read says best practice is to us NT authentication in SQL server. And I can see some advantages to that but using NT auth how do I force users to access the data using only my ...
0
votes
1answer
93 views

How to delete duplicate records in my database? [duplicate]

I joined about 12 databases into 1 db and in each database I have some duplicate records. How can I delete all duplicate records in my joined database? For example, I want to delete duplicate ...
0
votes
0answers
276 views

Management Studio Database Space Available

Recently I have installed a fresh version of sql server 2016 RC. I get an error when I try to import a bacpac file from azure. SQL72012 Generate drop statements for objects that are in the target ...
0
votes
2answers
158 views

Can I restore only the LOG of a database?

We have a 1.5TB database. I could create some replication strategies do replicate the database to another server in a fixed time.But the developers don't know when they will need to replicate this ...
0
votes
0answers
51 views

Indexes and performance

I am wondering about the best way to design indexes. For Example i have this table CREATE TABLE [dbo].[CoursePrerequisiteAssignment]( [Id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [...
0
votes
0answers
168 views

DBCC CheckDB result sent to OSQL poses confusion

Reformulated the Question I have a .BAT script that runs the DBCC CheckDB and repairs the database if needed. The result of the DBCC CheckDB is sent to OSQL through the -b flag and the .BAT ...
0
votes
1answer
291 views

How to handle HUGE 16GB SQL file?

I've abc.sql file exported from MySQL Table. This abc.sql file is 16 GB in size with around 28 million insert statements. I'm looking for option to store it in SQL Server Database. Couple of ...
0
votes
1answer
41 views

HADR procedures

We are thinking of a SQL Server 2014 + Windows Server 2012 configuration for a HADR scenario. My questions are: on a HA scenario, how does the primary server get updated once it is again available ? ...
0
votes
0answers
960 views

Distributed transaction debug

I have the classic error: Msg 7391, Level 16, State 2 When I try to execute a transaction over a linked server. I have the same identical configuration in 2 environment, production and test. It ...