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
-2
votes
1answer
44 views

SQL Server Event Log Summary [closed]

I want to generate a daily summary of SQL Server Event Logs which will be sent via email. I have currently been able to set up SQL email alerts for error logs,but they are sent individualy when an ...
1
vote
2answers
48 views

Unable to retrieve query plan of running query because of blocking

I am trying to troubleshoot a long running query in a stored procedure that around once every month randomly runs for ever and never finishes. Probably some plan caching issue. But the problem is ...
21
votes
1answer
720 views

In SQL Server, why can a backward scan of clustered index cannot not use parallelism?

I've been reading about SQL Server internals and every book or blog mentions this about backward scans. A backward scan of a clustered index cannot use parallelism The only post that said ...
3
votes
1answer
100 views

Best way to divide CPU along all sql instances on 1 server

I have a physical server with 40 CPU's (hyperthreaded) with 2 NUMA nodes. On this server I have 20 SQL Server instances installed and I need to make sure each instance has some dedicated CPU assigned ...
0
votes
3answers
39 views

Check if a SQL Login exists without SA

How can I check if a SQL Login exists for an arbitrary domain user if the account I'm running doesn't have SA rights to the instance (but will be dbo on at least one DB) Ideally I'd like the solution ...
2
votes
0answers
36 views

Performance test against identical tables (including data) with very different results [closed]

I created 2 identical schemas and a jmeter performance test to highlight the differences between an indexed and non-indexed table. All tables have clustered indexes from their primary keys. Before ...
-1
votes
1answer
51 views

restart sequence when the year changes

Is it possible to do a sequence with Start at 1 and INCREMENT 1, and when changing the year, restart the sequence? -- code# Create a sequence CREATE SEQUENCE SEQ_ALUNO START WITH 1 INCREMENT BY ...
0
votes
3answers
31 views

Create Synonym error for a user-SQL Server

I have a user who has permission to create synonym in my sql server 2016 database.That user also has data reader permission. When the user tried to create synonym as shown below. USE [DEMODB] GO ...
5
votes
2answers
95 views

CLR Stored Procedure on Azure SQL Managed Instance error on execution: “Assembly in host store has a different signature than assembly in GAC”

I have a CLR stored procedure which executes correctly when deployed to local SQL Server instances from SQL Server 2012 - 2017. I can successfully deploy to an Azure SQL Managed Instance but when I ...
2
votes
1answer
30 views

How to combine date and time with a string value in column created by Case in SQL Query

I am in the process of creating a query for an SSRS report that will show a column that has DATETIME values. The column can have NULL values. In my query I would like to use a CASE expression. I ...
5
votes
3answers
221 views

SQL Minimum Row count

I have a stored procedure that allows users to pass in parameters. SELECT * FROM Table1 WHERE columnA =@paramA, ColumnB=@paramB.... I need to hide the results if there are less than 10 rows, but ...
1
vote
0answers
19 views

Syncing On Prem SQL Server with Azure SQL

We have a SQL 2016 instance running production systems at a pretty healthy load within AWS. On top of this we host instances of production databases in Azure for PowerBI and analysis usage. At ...
1
vote
1answer
22 views

sql delete records based on combination of multiple fields in other table

I need suggestions on deleting records in relation with another table Main Table: c1 c2 c3 2 5 3 1 2 8 1 2 NULL 1 4 7 2 4 8 1 3 NULL 2 5 NULL 5 1 3 1 5 1 I need to delete all rows ...
1
vote
2answers
54 views

SQL Server: Explaining to C-Level Executives the impact of using Primary Key of VARCHAR(50) in many tables throughout a database?

Suppose a global, mid-sized company is considering a document control management solution that is backed by a SQL Server database and allows developers to create document form types using a form ...
3
votes
2answers
93 views

How to query data in backups?

I have an ASP.NET app using SQL Server 2017. There's a bug somewhere that's causing some records to be deleted, and I'm trying to recover the data and find the cause of the bug. We take daily backups, ...
0
votes
3answers
88 views

How Can I clone a database in Microsoft SQL server using PHP?

I am creating a portal where user can create the b2c or b2b store itself, so I need to clone the sample database to perform the task. It's not looking simple to clone the database in MSSQL. Please ...
0
votes
0answers
13 views

Modeling tabular structure in MSSQL to store data like Excel sheet applying Column inheritance

I've created this database structure to store tabular information (it's a simplification of my real structure but enough to show the point). In it I have Sheets and each Sheet can define different ...
0
votes
0answers
14 views

Not able to migrate DTS package from SQL Server 2008 to 2012. Getting errored out

Requirement: We need to migrate SSIS/DTS package from SQL Server 2008 to another machine having SQL Server 2012 on it. Steps performed so far: 1. First I exported the package from Source server to ...
0
votes
1answer
22 views

Extract all records even with missing “optional” fields in another table

I have a main product table ICITEM listing product IDs and another table ICITEMO (please don’t ask about the table names) with a number of optional product fields. Not all optional fields exist for ...
0
votes
0answers
32 views

Replicate SQL Server 2008 across domains

I have been tasked with migrating a database, size being up to 15Gb, from a SQL Server 2008 database in a 3rd party cloud VM, to SQL Azure. On go-live day, when we switch from the old host, the Azure, ...
0
votes
0answers
17 views

Cannot failover an availability replica for availability group since it has CLUSTER_TYPE = NONE

Using SQL Server 2017, when I try to manually failover AG to the secondary node by using Failover wizard in SSMS, I got following error Cannot failover an availability replica for availability group ...
4
votes
1answer
181 views

Scripting a Maintenance Plan in SQL Server Express

How would I run each aspect of Ola Halengren's sql maintenance plan on SQL Express? It's my understanding that each job should be run in a specific order. I'm sure that a .bat or cmd file can do ...
0
votes
2answers
51 views

Which SQL Server/Windows logins require the sysadmin role?

I'm setting up a new SQL Server instance. Which of these SQL Server/Windows logins should have the sysadmin role? NT AUTHORITY\SYSTEM NT SERVICE\SQLWriter NT SERVICE\Winmgmt NT SERVICE\MSSQLSERVER ...
2
votes
2answers
50 views

Check if any table has a user defined type

I've seen on sys.table_types that I have 8 user-defined table types on my db. How can I check if there is any table (1000+) on my db that are currently using any of these user-defined table types ...
0
votes
1answer
30 views

how to find tables with either sparse or a column set column?

from the error message below: A compressed index is not supported on table that contains sparse columns or a column set column as I was rebuilding an index and changing the data_compression to ...
2
votes
1answer
48 views

Is TEXT to VARCHAR(MAX) an implicit conversion?

I am copying TEXT columns to another table where the destination column is VARCHAR(MAX). It appears that this is an implicit conversion and that I do not need to write an explicit CAST for it. Is ...
0
votes
1answer
54 views

Help needed with SQL Server query: Accessing columns not in GROUP BY clause

I have a table whose columns are as follows: CREATE TABLE Tests ( TestDate date, EntityID int) Using a stored procedure, I want to find the ‘academic year’ of pairs of tests that happened in the ...
2
votes
1answer
47 views

Find SQL text from Plan Diagram in SentryOne Plan Explorer

I had SSMS create an execution plan and opened it through the context menu in SentryOne Plan Explorer. I go to Top Operations, select one with huge cost and switch to Plan Diagram. The node ...
0
votes
1answer
36 views

Align values to 5 minute intervals

I have values inserted with random intervals in the table. I would like to fetch the first (if exists) value in (say) 5 minutes interval. So is required to have 5 minutes column and the values column ...
-2
votes
2answers
51 views

get data from express edition db to developer edition [closed]

Hi I've installed freshly db of ssms developer edition and Uninstalled express edition but I've a issue that I forget to take back up of that database.I've same data in c drive program file MS SQL ...
1
vote
0answers
21 views

verification error on importing csv file into ssms [closed]

I have a .csv file containing slightly more than a million records, and I want to import that file into SSMS 2017 but I get an error while verifying the datas as you can see in the following snapshot: ...
0
votes
1answer
39 views

SQL Full Backup job is taking too long to complete

I am facing a strange issue with daily FULL backup. We have a total of 23 databases. We have 1.21 TB big database in this SQL server 2012 Standard Edition. We are taking daily FULL database backup for ...
1
vote
1answer
37 views

TempDB Transaction log not releasing space

Every time I complete a transaction in tempdb, the temp log grows, however the log doesn't seem to release the space once the transaction has completed.The log usage percent is 43.4% but seems to ...
2
votes
1answer
149 views

History of cluster failover

Is it possible to get a history of when a cluster failed over and which node became the active node?
0
votes
1answer
27 views

How to Calculate Month over Month User Retention based on already active users (not based on user signup date)?

I have a Table which tracks User activity (i-e user started a session at what time ?). This table contains the data from Dec 2018 Till now. I need to calculate monthly retention (not based on signup ...
0
votes
1answer
32 views

db_mail Mail Server Failure

Description/Background: I have spent the last couple of days searching everywhere on the internet and have not managed to find a solution or a proper explanation of my issue. since a couple of weeks ...
0
votes
1answer
39 views

SQL server - data successfully inserted in a table but not returned in Select Statement

SQL select query not returning records, even though the data insert operation is successful. We have a table [dbo].[Login] in our database where data is inserted using the below stored procedure. The ...
0
votes
2answers
29 views

SQL Server Backup Database not .bak file format

I've been using SQL Server 2012 for as long as I can remember. When I do a backup it's always saved as .bak file format. However, there's this other server that has SQL Server 2012 and when I do a ...
6
votes
1answer
111 views

Deadlock Priority High Chosen as deadlock victim

I have SQL Server 2016 SP2 (13.0.5237.0). Here is a deadlock graph I noticed recently in my system. The process with high deadlock priority was chosen as a victim (probably because of high log usage ...
0
votes
1answer
42 views

Connecting to database engine again when a new query or running view

When I connect to a server via SSMS, I can connect fine albeit a slow. When I click on a new query or try to run a view in a database on this server, the same prompt comes up but with everything ...
0
votes
0answers
41 views

many of the same queries on the query plan - whats the pros and cons of Forced Parameterization in this scenario?

while working on finding all the queries in the query plan that are related to a particular index I realised that there were too many duplicates of the same queries on the query plan. Finding what ...
4
votes
3answers
133 views

Is there a limit to how many backups can be appended to a single file?

A recent question got me looking at MS Documents and wondering. Is there a limit to how many backups can be appended to a single file? By default SQL Server uses NOINIT to append new backups to the ...
0
votes
2answers
50 views

Not able to delete transaction log backup file

I have a big SQL Server database (~1.5 TB) and i didn't take log backup of that database for last two weeks for some reason. Today i found that the .ldf file of that database became huge around 1.5 TB....
0
votes
0answers
9 views

Tuning SQL Server 2012

We migrated from Oracle to SQL Server, the new server has good resources and should burn through data. When reading OS MasterMap data it consumes over 50% of cpu and takes several minutes to load. I ...
3
votes
1answer
93 views

Is Network I/O included in the timings for “RPC complete” seen in SQL Profiler?

When watching results in SQL Profiler, does the RPC Complete include time to send results to the client? Or is it just the time the server spent gathering the records? The reason I'm asking is I'm ...
1
vote
3answers
91 views

remove leading and trailing quotes

I have a field that may start and end with quotes. I only want to remove the quotes if the string starts and ends with quotes. If quotes exists inside the string then I wish to retain them. I have ...
0
votes
1answer
25 views

Convert sql_variant to varchar to select left 2

Hi I am trying to populate a column (versionstatus) with if the service pack needs updating. I have created a lookup table which lists the SQL Version, and the latest product version, e.g. SQLVersion ...
2
votes
1answer
26 views

Msg 15404, Level 16, State 10, Procedure xp_logininfo - missing permissions [duplicate]

I have a server based in the USA, where I am not a domain admin, and my permissions are limited to sql server only - where I am sysadmin. after a migration of a few databases to a new server, I ...
-1
votes
0answers
36 views

How to import database backup file into another database in Microsoft SQL using PHP?

I'm trying to import the .bak file into another database on Nginx server using a PHP script but it's not working. Actually, We have a custom CMS portal to create stores from back-end and I am trying ...
0
votes
1answer
19 views

Amount of used cache / free cache

I need to find out how much cache is used, and if there is free cache available. Background: Queries on a production server take a lot of time when the server is under heavy load. I suspect that ...