Questions tagged [sql-server-2012]
SQL Server 2012 (major build version 11.00.xxxx). Please also tag sql-server.
4,529
questions
0
votes
2
answers
74
views
sqlserver memory problems,How to check the memory usage
I want to know whether sqlserver has a memory bottleneck, how bad the free memory needs to be
Can you see which statements use more memory
thank you
Read some information do not understand, want to ...
0
votes
0
answers
57
views
Sql server database restoring from backup, sql users without login
After restoring a database from another SQL server, set database comes with database users without login. Do these users have any actual functionality or they are practically dead users? I've looked ...
0
votes
1
answer
29
views
Get Point from Another Table based on Category and Value Range
I am trying to get a column which specify the points by comparing the value from original table to min and max value from another table. I have a main table, which consists of few columns of values ...
-3
votes
1
answer
20
views
In what format do I need Insert 3 table sql? [closed]
In what format do I need Insert 3 table sql?
animals(`AnimalsID`, `Animals`, `IUCN_Red_List`, `TypesID`, `BloodedID`)
types(TypesID,Types)
blooded(BloodedID,Blooded)
0
votes
0
answers
46
views
Convert a list-of-IDs column into a junction table [duplicate]
I have a table, Office, with a column that contains lists of ids representing many-to-many relationships:
TABLE Office {
OfficeId int IDENTITY(1,1) NOT NULL,
CubeIds NVARCHAR(MAX) NULL, --values ...
0
votes
1
answer
78
views
Deleting rows using count after reaching certain threshold MS Sql server 2012
I'm trying to make a loop query for Sql agent which checks users data and if the criteria is met reward is sent, after that it would delete the records from the table restarting the loop. The issue is ...
0
votes
0
answers
40
views
Linked server view Select query doesn't execute on production server
I've build one view. I can run sys.databases from the linked server. However, when I tried to execute the following view. It is not retrieving any data from the linked server.
USE [SSISDB]
GO
/****** ...
0
votes
0
answers
115
views
Removing/disabling a single SQL instance on a failover cluster?
I need to retire a single SQL instance on a (classic) failover cluster while leaving other SQL instances running. SQL version is 2012 in case that matters, but this could come up for other versions in ...
0
votes
0
answers
86
views
How to delete specific table partition in SQL Server?
I am able to switch out and IN and also truncate partition.But I am not able to delete specific partition file in SQL Server. Suppose there is total 4 partition in order table, I don't need partition ...
0
votes
1
answer
108
views
SQL Server 2012 how to audit user's access to database tables and views?
We have a read-only login account that unfortunately was created without proper planning, and now users throughout the company are using this login to access tables and views in our database. The ...
1
vote
0
answers
18
views
New WS install win11 Pro and O365: Connection to DB fails due to change in ownership from SQL to Azure. Is it a Permissions issue?
Security System: Unable to connect to Local Database Template.
Error Message: The remote computer that you are trying to connect to requires Network Level Authentication (NLA), but your Windows domain ...
0
votes
0
answers
42
views
SQL query to find device list in specific AD group
I have AD Group which has user ID list but I need device list so looking for the SQL code which can convert this AD group and give me the list of device used by the users present in specific AD group.
0
votes
0
answers
80
views
Counting Rows From a Value in a SQL text box - please please can anyone help?
I just can't find an example of this anywhere and hoping someone can help.
I have a query which returns a list of care services and other fields based on the care service table values and calculated ...
0
votes
0
answers
44
views
Server is Distributor, but Can't set database for replication
I Have a server that is already a Distributor. This happened in the past. Nobody nowadays knows why it is configured as a distributor, there's not even the "distributor" database.
We don't ...
0
votes
2
answers
38
views
Specify constraints during table creation by select into
Can we explicitly specify "not null" and "primary key" constraints for a column of table that is dynamically created through execution of "select into"? Something like ...
0
votes
0
answers
103
views
Query update issue, it updates only the first match sqlserver2012
I'm trying to transfer part of data "ID" from table1 to table2, you may ask why doesn't table2 have the all the data. Answer is simple the data is generated by a program which doesn't ...
1
vote
1
answer
60
views
sql server - How to prevent backup db file to load on any SQL server instance
I am trying to find if there is any way we can restrict loading of a .bak file to be loaded on SQL server instance.
Example:
User named "Zack" created and is dba of a database named "...
-3
votes
1
answer
36
views
Build logic on Reversal record flag for a particular table
I have Reversal flag (RF) values as ' ' , 'R' , 'D' which make the records distinct. I am selecting many columns from this table as it is a primary table and taking sum of few columns as well. There ...
-1
votes
1
answer
193
views
What causes a stored procedure to have multiple plans in SQL Server?
We have noticed that many of our stored procedures, which involve the use of local variables, have multiple plans associated with them. By which I mean the same query in the stored procedure has ...
0
votes
0
answers
34
views
Stored procedure suddenly using multiple execution plans in SQL Server 2012
We have a commonly utilized stored procedure that had been functioning properly, but it unexpectedly began utilizing several plans (as many as 20, according to the performance analyzer) and causing a ...
2
votes
2
answers
1k
views
How can I optimize the stored procedure and reduce table scans?
I have a stored procedure which identifies any changes in candidate information from the last SSIS job run. Then it proceeds to save the changes in a sync table.
CREATE PROCEDURE [dbo].[...
2
votes
1
answer
574
views
SQL server memory component CACHESTORE_SQLCP is way more than the plan cache
In our production server (SQL server 2012) when I checked the memory component CACHESTORE_SQLCP is consuming the much more than the total size of the cached plans. Is there any reason for it and how ...
1
vote
2
answers
3k
views
Best Practices to archive or remove old data in SQL Server 2012
Our application has numerous tables that contain outdated data, some dating as far back as 2010. Despite having indexes defined on these tables, many of the index seeks retrieve old records, which is ...
2
votes
2
answers
213
views
SQL Server 2012 Standard Edition rebuild index
We use SQL Server 2012 Standard Edition. Is there a way to rebuild the index, trying not to cause data table locking, and reducing the impact on performance?
When we rebuild the index, it causes the ...
-1
votes
1
answer
78
views
Creating a hierarchy from text
I'm trying to create a hierarchy from a text field I have in my table.
Visually it is relatively easy to see who is parent and child.
For example: (see a screenshot of the table results)
1M
-----1M5
--...
5
votes
2
answers
360
views
Varbinary update attempt
Is it possible to adapt this into update query which has to seek a free sequence of 3 bytes or (0x000000) and replace it with a new sequence if the data is split like this every 3 bytes? The issue is ...
0
votes
0
answers
87
views
Join remote tables with local tables in SQL Server 2012
If I have to join a local table to a remote table then I usually use the 4-part identifier. For example:
select t.id, r.region_id, r.cost
from localdb.dbo.product p
join linked_server.remotedb.dbo....
1
vote
1
answer
162
views
Filtering in Queries using Linked Servers in SQL Server 2012
My colleague told me that any query that uses a linked server first transfers the data from the remote server to the server the query is running on and then applies filters. For example, if I have the ...
1
vote
3
answers
158
views
Alter a scalar UDF that is used in a check constraint in SQL Server 2012
I have a check constraint on a column that uses a scalar UDF. I have a requirement where I need to make changes to the UDF. Based on what I know, I need to drop the constraint, make changes to the UDF,...
0
votes
0
answers
108
views
SQL Server: Spatial Indexing and Bounding Box
I have two tables each with a SHAPE Geom Column, and I'm working on getting the intersected area between every shape in the first table with the second table.
The second table has millions of rows, ...
7
votes
1
answer
2k
views
Does With(NoLock) help with query performance?
Most of the select statements in our stored procedures use WITH(NOLOCK) and I was told by my co-workers that they use it to improve performance. Now, I know that this hint helps with locking but does ...
0
votes
0
answers
64
views
Improve query performance in SQL Server 2012
I have a table with 150 million rows with a non-clustered index on userId. I have to write a query to filter on userId and return all the rows if the productType is not SIG and return only rows ...
0
votes
1
answer
288
views
Modify an existing non clustered index or create a new index in SQL Server 2012
I have a table with 150 million records and 8 indexes. One of the indexes is on userId. A lot of the current queries I have filter on userId and therefore this index works perfectly. For one of the ...
5
votes
1
answer
1k
views
How to Retrieve (Debit, Credit and Balance) from daily Transaction tables (Customer, Invoice, Payment) Full and Date Range)
There are 3 Tables Customer, Invoice and Payment. Customer Link with Invoice and Payment table. Question is, need to retrieve statement wise Debit, Credit and Balance. main issue is opening balance ...
0
votes
1
answer
50
views
Re-write a query in SQL Server 2012
I have 3 tables:
order: contains the list of all the orders;
product: contains the list of all products for each order;
productVersion: contains multiple versions for each product.
I want to write a ...
0
votes
1
answer
431
views
Cannot open backup device 'D:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\D:\DB_backup\uni.bak'
I have 2 database backup files casa.bak (25 GB) and uni.bak (176 GB) in the same folder. I'm using the same script to restore the database for both files previously both were working successfully. Now ...
0
votes
1
answer
918
views
Convert an Int column to BigInt in a stored procedure in SQL Server 2012
We have a stored procedure that uses SUM on an Int column in the SELECT statement. We have a few cases where for one of the parameter values, the SUM(integer column) exceeds the Int range and ...
2
votes
1
answer
73
views
Forwarding SQL Server Error Logs to Another Server
I wasn't sure where to post this question. If this is not the right place, kindly point me in the right direction.
We have SQL Server 2012 and 2014 on-prem. My intention was to forward the error logs ...
0
votes
0
answers
72
views
How do I edit DataRows of DBF file via SQL Server Management with Query?
I have an old DBF file that I want to manipulate its data directly through SQL Server Management itself, for example, perform update, insert, delete operations.
I tried using the following code from ...
2
votes
1
answer
485
views
Return the inserted timestamp after inserting a record [duplicate]
I feel like this should be an easy problem. All I want to do is return the timestamp of the entry that was just inserted, but in the same call. All I can find in my searching is about returning the ...
0
votes
0
answers
98
views
How to get exact SQL output for below mention input
Input table data :
itemid
MfrCatalog
MfrNameNorm
RawDescription
UOM
Conv
noun
Modifier
420754
G322H
ETHICON, INC
SUT PLAIN 3/0 27IN
EA
1
SUTURE
ABSORBABLE
420754
G322H
ETHICON, INC
SUT PLAIN 3/0 ...
0
votes
1
answer
296
views
Performance benefit of dividing a frequently used stored procedure into multiple stored procedures in SQL Server
I have a stored procedure usp_appdata that is used by our application loading screen as well as a lot of other places in the application. This SP is very resource intensive and returns a lot of data. ...
2
votes
1
answer
3k
views
SUM total amount of each column from two tables SQL Server
By joining two tables, the total amount obtained from Crowdfund_Users is incorrect. Sum of Amount in table Crowdfund_Users increased by an additional 60000 from ID 5.
table Crowdfund_Users (ID is ...
0
votes
0
answers
114
views
In SQL 2012 - Export Data-tire Application Error: Database source is not a supported version of SQL Server : . (Microsoft.SqlServer.Dac)
I have asked to move Database from SQL server 2012 to azure SQL During the export data-tire Application Its shows Error :
Database source is not a supported version of SQL Server (Microsoft.SqlServer....
0
votes
1
answer
1k
views
Updates to the same table in concurrent sessions in SQL Server
Consider the following scenario:
10,000 users try to create a profile on our application concurrently at the same time and the data has to be inserted into the table, userProfile.
The SP that handles ...
5
votes
3
answers
433
views
Is there a way to sort by an alphanumeric column? [duplicate]
I have a table units
unitname
unit 1
unit 2b
unit 2c
unit 2a
unit 10
unit 3a
unit 3c
unit 11
I want to sort the same as
unitname
unit 1
unit 2a
unit 2b
unit 2c
unit 3a
unit 3c
unit ...
2
votes
0
answers
153
views
Setting up Database Integrity Checks
I'm relatively new to SQL and, unfortunately, am definitely not at the level of a DBA - However, it's become my job to look into some SQL issues...
There's a Database Integrity Check set to run for ...
4
votes
1
answer
125
views
Official Source of What Time Zone an XEvent is Logged
I'm trying to prove that extended events (hence audits as well) are logged in UTC time zone and can't be changed but I can't find an official source. I've searched Microsoft's pages and SQL Server ...
0
votes
1
answer
168
views
SQL server web edition licensing [duplicate]
My hosting company says SQL Server web edition has 16 cores limit, but at same time they provide license of 24x2 for SQL Server web edition, which we are not sure if its utilizing all CPU cores or not....
2
votes
1
answer
744
views
Have to regenerate SQL Server Master Key after every server reboot
We recently migrated our database over from SQL Server 2012 to a new SQL Server 2019 box. As soon as the database was migrated, I regenerated the master key, but whenever our SQL Server 2019 box ...