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.

3,647 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
-2
votes
0answers
35 views

Error to migrate DB 2008 R2 to 2017 Standard

I have data base with 35 GB when i try to migrate it from 2008 R2 to 2017 standard with the usual method detach and attach file she show me that I was same partition Id crashed and the same when I do ...
-2
votes
2answers
41 views

Which serverless database to store user data and images?

I am designing a cloud deployed system where users can log in and upload some user-specific images (not super large files, but maybe sometimes >1mb that are then later displayed in the system to ...
-2
votes
1answer
29 views

Exception Message: Unable to connect to the remote server

I am trying to backup a database in azure storage and I keep getting the below messages Msg 3271, Level 16, State 1, Line 1 A nonrecoverable I/O error occurred on file "azure storage backup ...
-2
votes
1answer
43 views

Update query with where clause taking time on clustered index with millions of data

CREATE TABLE Test_Table ( Id INT NOT NULL, Column2 VARCHAR(64) NOT NULL, Column3 VARCHAR(10) NOT NULL, Column4 ...
-2
votes
1answer
24 views

ALTER DATABASE MODIFY FILE fails - I want to alter data file sizes using size = @variable - not working

Example: DECLARE @sql NVARCHAR(255) DECLARE @DBname NVARCHAR(128), @FileName NVARCHAR(128), @NewSizeMB INT SET @DBname = 'AGTestDB' SET @FileName = 'AGTestDB' SET @NewSizeMB = 1024 SET @sql = N'...
-2
votes
1answer
51 views

Can't create availability group , big error message

hello I am setting up my "high availability group" and I have a little problem, I have this error message . maybe I have to validate my cluster first? I already tried to validate but I also receive ...
-2
votes
1answer
36 views

Select the site where the employee have reported more compare to other sites

I have 4 columns in my table. emp_name | emp_id | site | date_of_work blhf | 2323 | NAM | Jan-01-2020 blhf | 2323 | NAM | Jan-02-2020 blhf | 2323 | NAM | Jan-03-2020 blhf | 2323 | NAM | Jan-04-2020 ...
-2
votes
1answer
34 views

How to include empty values using in a query to create relationship between column and row

I have a query who returns the next results +-----------+--------+-------+ | idPeriodo | codigo | valor | +-----------+--------+-------+ | 1 | 7 | 1000 | | 1 | 8 | 1000 | ...
-2
votes
1answer
20 views

Subtracting the previous qty to the current quantities

I have a table as: Here I want to subtract the required Qty for a part from On Hand and then the result from the required for next sequence Hoping to get this as a final result:
-2
votes
1answer
622 views

Can I use log shipping between different editions of SQL Server 2016?

Will log shipping work between different editions? Primary is SQL Server 2016 SE and Secondary is SQL Server 2016 EE. If not, how else can I set up high availability for this combination of servers?
-2
votes
2answers
79 views

Can I return my dynamic sql query into a temp table that can be selected after execution

I am trying to return my dynamic query results into a local or global temp table to be able to manipulate and / join other tables, etc. I cannot seem to get the results into a temp table. Any help ...
-2
votes
1answer
38 views

How does 'Top SQL - By Application' values from SQL sentry correlates

I have run a performance simulation on my application server and pull the sentry report for my analysis. And While going through the top sql -by application, I found difficult to correlates the values ...
-2
votes
1answer
41 views

Help me write this query in SQL

I'm trying to get help writing a query from scratch SQL. Thanks Here is Question: Find email addresses dbo.[EmailAdresses] that are not associated with any person dbo.[Person]. Return [...
-2
votes
1answer
26 views

i need to change all my user databases from full recovery to simple by using command in four servers

I need to change all my user databases from full recovery to simple recovery by using command in all my servers. need to create a stored procedure can you please give me a solution .. Thanks in ...
-2
votes
1answer
118 views

Can ETL access Data while Rebuild Index Operation is running

Can I get some help to understand below questions: We have a ETL job running (Datawarehouse Server) and weekly index operations (Production Server)(Ola Hallengren script) , below questions are ...
-2
votes
1answer
3k views

Join multiple tables related by a comma-separated list of IDs

FeePreference table: Id Name FeeParticularIdList BatchId 157 NewStudentOnly 838 77 158 NewStudentOnly 849 78 159 NewStudentOnly 860 79 160 NewStudentOnly 871 80 161 ...
-2
votes
1answer
965 views

Calculate row size and actually table size using between dates period?

I am trying to get the actually size of records based on the date which they where created. i used a count to get the number of rows in the table then multiply the result by the top average byte. I ...
-2
votes
1answer
487 views

NVARCHAR(MAX) to datetime conversion (SQL SERVER 2012)

I have a table in which a column is nvarchar(Max) and date value is stored as for eg: 'Tue Aug 22 00:00:00 PDT 2017' How do I convert this value to proper datetime value I tried Try_Convert, ...
-2
votes
1answer
71 views

Calculate price drop same or next day

I have a table with RIC(string), open(money) and Date(mm/dd/yyyy) format. I need to see when the price drop was >=25% and whether it happened on same day or next day. For example, ASF had price ...
-2
votes
1answer
49 views

Adding field from another table into exising functioning query

We have 2 systems, the Warehouse management system (WMS) and SAP. I have a query I can run in SAP which will generate me a TRUE free stock report for all items based on information in the WMS (A1WMS)....
-2
votes
1answer
542 views

Optimize a query using same temporary table in outer apply

I have a query using outer apply on the same temporary table again(written by someone long back). It is performing very slow.Please suggest ways to improve. Thanks in advance. UPDATE fb ...
-2
votes
1answer
52 views

Getting information regarding the data into tables insert,update or delete in sql server?

Is there a way to retrieve information for tables in my database that can illustrate what DML has or has not occurred for a time period? What information, if any, does SQL Server store?
-2
votes
1answer
53 views

How link data - delimiter

How can I make script take mydata from mytable instead of providing values like in an example below? SO instead of set values to Code and Location link these to mycolumns in mytables? with data as ( ...
-2
votes
1answer
2k views

SQL Server 2008 R2 - Rebuild Log

I'm trying to rebuild a log file for my database. I want to know if what is happening is normal. This is what I'm doing: use master ALTER DATABASE my_db SET SINGLE_USER WITH ROLLBACK IMMEDIATE; ALTER ...
-2
votes
1answer
51 views

Design for table

I have a table: TABLE ( A int, B int, ..., H int, DataValue float ); All of my queries do aggregate operations, with A and some other columns (several combinations) in the WHERE clause (A is ...
-2
votes
1answer
137 views

How to concatenate rows into one comma seperated value when used with case statements

I have a query that has multiple case statements. I am trying to reduce the results to one row per USER_ID that has one of the columns (specialty_id) comma separated because some users have more than ...
-2
votes
1answer
420 views

Creating Rule to Check for Validity of SSN string and Binding to Column

I have a table Person with a column SSN . I want to use a rule to make sure the SSN items entered are syntactically- correct, i.e., they consist of strings of the form xxx-xx-xxxx where each x is a ...
-2
votes
1answer
636 views

Scheduled jobs run twice after upgrade to SQL Server 2012

We recently upgraded from 2008 to 2012, with one of our applications running on an active & passive server (Always On). It has been running SQL Server Agent jobs twice at the exact same time. We ...
-2
votes
1answer
708 views

Connect an desktop application to my SQL Server using internet

I want to connect a desktop app to a SQL Server using internet, not local. The app will run on every network in the world with internet and the data will retrieve and send from my PC using SQL Server.....
-2
votes
1answer
71 views

how to select column3 from rec1 value which is matched to column1 val in rec2

i am having following scenario : col1 col2 col3 10 2 13 13 4 14 14 5 15 15 6 16 form the above given table col3 value(13) in row1 is seen in col1 value(13) in row2 ...
-3
votes
1answer
27 views

Convert a query results from lines to columns so i can see somes values from a column in columns

Just need to have just 1 line from this query (that returns several lines due to the columns "Questão" to right. I'll need to have each value of that columns in a column so i can have just one line ...
-3
votes
1answer
62 views

Print Two Different Columns with Union All- SQL

I have an SQL statement like this, SELECT * FROM (select "John" as FirstName Union All select "Mary" Union All select "Alis"), (select "Doe" as LastName union all select "Queen" union all ...
-3
votes
1answer
185 views

Setting Cardinality Estimator in SQL Server 2016 for performance & using old CE of SQL Server 2012

Post upgrade to SQL Server 2016, we saw a lot of I/O issues followed by slowness which affected the whole system. Upon investigation, we found that top queries are delete statements. Execution plans ...
-3
votes
1answer
796 views

How to update with join query and case when condition?

below query is just updating INTIME and OUTTIME and rest of case when condition is not getting calculating as per case when condition. Update EmployeesAttendance set EmployeesAttendance.INTIME=@...
-3
votes
2answers
37 views

how can update part of the value in SQL

i have this sample: i wanted to change the value of '&' into 'C:\' having trouble composing a script.
-3
votes
2answers
88 views

I need to copy values of a column from 1 DB to another DB on a diff column but has the same primary key

i need to copy the value of column of nickname and sysnbr to another DB on a diff table/column: I need to copy the nickname column and sysnbr column to this table. this is on another DB nickname = ...
-3
votes
1answer
90 views

View sysextendedarticlesview

Does anyone know what this view is for? Its obviously system generated and I have found it in 2 of my replicated databases but not in others.
-3
votes
1answer
416 views

calculate count by month and year

I am trying to calculate how many people are on a waiting list or still on the waiting list at the end of the month. Ex. If 5 people are waiting in Jan and then in Feb 3 people get added to the list ...
-3
votes
1answer
60 views

Can we shrink a 1.6 TB SQL Server DB in Simple mode with only 12 GB Storage left?

We saw your article about this topic and wondered if you can answer this question: Can we shrink a 1.6 TB SQL Server DB in Simple mode with only 12 GB Storage left? Here is your article that we saw: ...
-3
votes
2answers
640 views

SQL Query performing slow on SQL Server 2016 SP1 than SQL Server 2012 SP3

I have a SQL query which runs under 1 minute on SQL Server 2012 SP3 but run over 2 hrs on SQL Server 2016 SP1.on Server side both server runs on identical hardware which is virtual server (VMWare),2 ...
-3
votes
1answer
38 views

SQL Server 2012 Permissions

I need to give permission to one of our contractor to create a database and user on the SQL Server. What minimum permission should I grant and how?
-3
votes
1answer
561 views

Create linked server in SQL Server 2008 R2

I tried to create linked server following the syntax: SELECT * FROM Server.Database.Schema.Table My created syntax: SELECT * FROM 145.17.58.228.AHS_System.AHS_User But getting error: Msg 102, ...
-3
votes
2answers
144 views

How to access multiple DBs same time

Can anyone help me on below query which gives me file group space used and current space. I am not able to use the code below. I want to execute the command in all DBs same time so I am using the ...
-4
votes
1answer
133 views

How to shrink a Tempdb without restart the server

I want to shrink my tempdb without restart. I tried all possibilities available in Internet like 1opentransaction(there is no open transaction) 2.
-4
votes
1answer
466 views

sp_spaceused on SQL 2008

I am unfamiliar with the results returned by the sp_spaceused procedure on SQL server 2008. Please see the output below: and Am I correct in reading this as there are 38.2 gigs of available space ...
-4
votes
1answer
4k views

How to Create a Trigger in SQL Server to Update Cascade When @@RowCount > 1?

I Have 2 Table Table1 | column name | type | |-------------+-------------| | ID1 | Int | | Name | NVARCHAR(50)| Table2 | column name | type | |-------------...
-5
votes
1answer
481 views

I get the error code 3154

I am getting the error code "3154" when trying to restore files and filegroups. I searched for a suggestion, and it said to click on (with replace); still no go. Full info: Restore failed for ...

1
69 70 71 72
73