Questions tagged [sql-server]

Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all Microsoft SQL Server editions including Compact, Express, Azure, Fast-track, APS (formerly PDW) and Azure SQL DW. Do not use this tag for other types of DBMS (MySQL, PostgreSQL, Oracle, etc.). Do not use this tag for issues on software and mobile development, unless it is directly related to the database.

Filter by
Sorted by
Tagged with
0votes
2answers
31views

Permissions to view certain databases

I have 4 databases, Database 1 Database 2 Database 3 Database 4 I have a client that I want to give access to my DB instance. If I give it full access it will see all 4 databases. I just want him to ...
user avatar
-4votes
0answers
25views

Merge rows in SQL Server 2012 [closed]

Please solve the issue related: enter image description here
user avatar
-2votes
0answers
42views

How to find why SQL query is not working?

I have a table named volunteer. I am trying to write select SQL query. Query is working perfectly on some of the columns but showing 0 rows affected in others even though there is data corresponding ...
user avatar
0votes
0answers
37views

How to use current month instead of hard coded date string in this VIEW [closed]

I have a table. In the table I have four columns. ProductID StartDate StatusDate EndDate From 2018 for every month until now I wanted to calculate active customers in each month. Active customer ...
user avatar
-1votes
1answer
34views

I want to get the updated Salary by EmpID

I have a column EmpID and Salary. I want to get the updated salary each EmpID. FIGURE 1 : ID EMPID Salary 1 00000 75000 2 00000 80000 3 00001 75000 4 00001 90000 5 00001 91000 6 00010 50000 7 ...
user avatar
-1votes
1answer
25views

Column value of one table should be column headings when query is executed

I have two tables: pet type Id TypeB 1 dog 2 cat 3 snake Then another owners Ownerid Pettype 001 1 002 2 003 3 004 0 I am trying to get the values those owners who have pets as in this ...
user avatar
-2votes
3answers
34views

How to calculate time difference between 2 different DATETIME columns in order to display the output in the format of H:MM?

Below is the table I have created and inserted values in it: CREATE TABLE Attendance ( ClockedIn DATETIME, ClockedOut DATETIME ) INSERT INTO Attendance(ClockedIn, ClockedOut) VALUES ('20160101 ...
user avatar
-2votes
1answer
27views

Query works in SQL Server, but not in Oracle

The following SQL statement works in SQL Server, but not in Oracle: UPDATE example SET ID = (SELECT MIN(ID) FROM example) + rownum Oracle complains: SQL command not properly ended Why is this code ...
user avatar
0votes
1answer
24views

Having trouble installing SQL Server PowerShell module on my company's server

Environment: Windows 2016 Server Standard PowerShell 5 Has Internet connection Running PowerShell as administrator JFrog is something new we're implementing but not sure if fully on server or not. I ...
user avatar
  • 13.2k
-1votes
3answers
45views

SQL Query to find the Row with first change of data

UniqueId ITEM DATE 1 A 2022-01-01 2 A 2022-01-02 3 B 2022-01-03 4 B 2022-01-04 5 A 2022-01-05 6 A 2022-01-06 7 B 2022-01-07 8 B 2022-01-08 9 A 2022-01-09 10 A 2022-01-10 11 A 2022-01-11 I ...
user avatar
-1votes
1answer
28views

How to drop duplicated rows on SQL Server

I have a table that looks like this: The problem is that down below the table there are a numbers that repeat itself. What I want to do is simple drop those duplicated numbers, so I could create a ...
user avatar
-3votes
0answers
29views

Trigger keep Inserting existing records

I have a Windows Forms app that sends data to my SQL Server database. It inserts data into multiple tables. Now I have created a trigger that fires when information is inserted into the database, and ...
user avatar
-1votes
0answers
22views

SELECT INTO + JSON_VALUE doesn't work with a column ending in "no"

This is part of my code SELECT JSON_VALUE (c.value,'$.orderNo') as WebOrderNo, JSON_VALUE (c.value,'$.orderStatus') as orderStatus, JSON_VALUE (c.value,'$.createDate') as Date, ...
user avatar
  • 1
-2votes
0answers
22views

Get all the information of the employees who do not use Dell computer but use accounting software [closed]

Get all the information of the employees who do not use Dell computer but use accounting software. select distinct employee.* from employee inner join pc on employee.empnum = pc.empnum inner join ...
user avatar
-2votes
1answer
32views

How to calculate Time Difference between Clocked In Date and Clocked Out Date in the format of H:MM in SQL Server? [duplicate]

Let's assume Attendance Table has the following columns: Clocked In and Clocked Out, and Data Type for both the columns is DATETIME For example, Clocked In column has the following Rows: 2016-01-01 09:...
user avatar
0votes
2answers
39views

Split multiple strings in SQL

I am trying to split multiple columns of strings at the same time. My original data looks like: Table1 UserID Type ProductID 1 A, B 001, 003 and I want to end up with UserID Type ProductID 1 A ...
user avatar
  • 5
-1votes
1answer
31views

Entity Framework .Net 6 with SQL Server stored procedure – parameter not supplied

This is my first attempt at using EF to call a SQL Server stored procedure passing in parameters. This is an update stored procedure that I'm testing, and I keep getting an error Procedure or ...
user avatar
  • 2,875
0votes
0answers
33views

Can a SQL Language Extension make REST API calls?

I want to create an extension to SQL server that calls external REST APIs. Before digging in further, I figured to ask the community if it's even possible. Are such extensions written in C# blocked ...
user avatar
-1votes
0answers
38views

SQL Server: improve the query speed

I have an issue of trouble shooting a slow query. I have 2 identical SQL Server environments - one is Prod, the other is Dev. I have a query which is basically something like: Select x from A inner ...
user avatar
0votes
1answer
25views

Date Function in Insert gives an error. How can I format my date to return the insert values?

create table Arbeiten ( m_nr int not null, pr_nr char(4) not null, aufgabe char(20) null, einst_date DATE null, constraint pk_arbeiten_projekt primary key(m_nr, pr_nr), ...
user avatar
  • 3
-1votes
1answer
16views

Get a Sum of Value returned from function for each Employee with the same Company

I have to get a total of all projects not started by an employee for a particular company (using CompanyId). I can get the total of projects not started per employee using a function that excepts the ...
user avatar
0votes
4answers
37views

Create SQL Database From DBContext EF Core

My pc suddenly got sick and all the data are removed and no way to recover them. I was working on several projects with .NET 5 using EF core 6 Database first approach. I cloned my projects from GitHub ...
user avatar
-1votes
0answers
12views

Microsoft Access 365 split form, scrolling causes record to jump to bottom and prevents further scrolling

I have a split form in Microsoft Access 365. When scrolling through the bottom datasheet, the sheet will almost instantly "jump" to the bottom row, and it becomes impossible to scroll back ...
user avatar
  • 31
0votes
0answers
20views

MS Access DB front end SQL Server Back End Unable to Open any form as New Record after table migration

I have similar issue to one previously posted but none of the answers helped. I cannot open any form in my DB to a new record. This all worked before moving tables from Access DB to SQL Server and ...
user avatar
  • 1
0votes
0answers
19views

Insert rows into a table where a row doesn't exist already using a Cursor

I was tasked with inserting 1400 rows into a database table, only if the row doesn't already exists. Best practice or not, I'm using a Cursor but looking for suggestions on best way to do this. Here's ...
user avatar
0votes
4answers
43views

Sum and group products by similar codes/category

My problem is that in the supplier's invoices I have the same product with different names. The goal I'd like to reach is to group them in a single product code/category. Do you think is possible? I ...
user avatar
-3votes
1answer
26views

Dash in SQL Record [closed]

I am trying to insert records into my table but keep getting an error due to the dash (Invalid column name 'NJB572'), how can I go about this? I have 2 columns in this table, both VARCHAR. INSERT INTO ...
user avatar
-1votes
0answers
19views

Select Data from Column in Table which Field ID Increments | Procedure Expects Parameter Which was Not Supplied

I'm trying to get data from a column (AlbumCover) from a table (Albums), where the ID of the row increments. (using the identity specification property). Problem is, I can't create a stored procedure ...
user avatar
-2votes
0answers
43views

Microsoft Sql Server Decrement [duplicate]

So I have this C# applicaiton and it uses a SQL Server database to show information on a DataGridView. My autoincrement column works fine but when I delete a value it doesn't get decremented by one. ...
user avatar
  • 1
0votes
1answer
29views

Is there a way where I can use MAX(Count(some_table_name)) in SQL Server?

I am unsure how to find the maximum of a count function, for example Select Count(Seat_Reservation.Customer_phone) as MaxTicketsBooked , Seat_Reservation.Customer_phone From Seat_Reservation Group By ...
user avatar
  • 21
0votes
0answers
23views

how to use int identity as guid for merge publication?

How do I set the nId column (from the example table creation code below) up as uniqueidentifier to prevent the merge publication wizard from creating an unneeded GUID column? I am trying to set up ...
user avatar
0votes
0answers
20views

Trapping errors using cmd.exe in SQL Server job

I have a job that runs a batch file as step1. I edited the batch file ( mybatch.bat ) as follows: call sub: >>mylog.txt exit /b %ERRORLEVEL% command1 command2 As you can ...
user avatar
0votes
0answers
26views

Append new data and update exisitng data in table from inserting another

In SQL, I have a table with 3 columns that is refreshed through the day. I want to append "table a" data to "table b". I need to ensure the there are no duplicate rows by date, but ...
user avatar
  • 19
0votes
0answers
14views

log backup job getting failed for particular DBs in secondary replica always on SQL

log backup job getting failed for particular DBs in secondary replica always on SQL with below error. Error : Log backup for databases on a secondary replica failed because the last backup LSN from ...
user avatar
-1votes
0answers
12views

What are the challenges we need to take care in migrating server version from JBoss 4.1 to JBoss 7.1? [closed]

We're working on a legacy project and got a requirement to upgrade the log 4j version from log 4j 1.2.8 to log 4j 2.17.1. So for this reason we need to upgrade the Java version as well which is from ...
user avatar
  • 39
0votes
0answers
13views

Scheduling a SQL Server OPENROWSET script using the Task Scheduler

How can I import excel data into a table automatically? Usually scheduled, maybe 10am of everyday. I have a program that spits out reports to a designated folder. I need SQL Server to pick up those ...
user avatar
  • 51
0votes
1answer
34views

Incomplete SQL Server CDC Change Table Extraction Using Batches

Basic issue: I have a process to extract records from a CDC table which is 'missing' records. I am pulling from a MS SQL 2019 (Data Center Ed) DB with CDC enabled on 67 tables. One table in particular ...
user avatar
-1votes
3answers
33views

LTRIM ending values throughout entire column using SQL

I have a table with a column named 'ProjectCode' with all values in the column set up as such: 123.21.000. I am looking to write something to iterate through the whole column and remove the ending ....
user avatar
  • 39
0votes
0answers
33views

Building tree structure of my network with SQL

I am a GIS specialist working in optic fiber infrastructure Newbie in SQL, i'm currently trying to build a tree like structure of our network from root to customer I have already built a very ...
user avatar
  • 1
-1votes
0answers
13views

Can not connect to SQL Server Express on docker from dotNet 6 project

My asp.net core app is succefuly connected to SQL Server Express on docker using : $ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 -d mcr....
user avatar
0votes
0answers
17views

Executing SQL-query from C++ using ODBC

I have the following snippets of code in CPP, which correctly lets me connect to my MSSQL-server. #include <sql.h> #include <sqlext.h> #include <iostream> #include <string> #...
user avatar
0votes
0answers
19views

Joining the same table a dynamic number of time

I have a table that contains a list of parent items and the child items that were used in production as follows Father Item Child Item Qty Used Parent1 Child1 5 Parent1 Child2 6 Parent1 Child3 10 ...
user avatar
0votes
0answers
12views

Dynamic SQL Query To Temp Table In SSIS

I am attempting to create a global temp table based off of a dynamic SQL query. I am using an execute SQL task. Thus far, whenever I execute it, the temp table is not created. Below is my script. I ...
user avatar
0votes
0answers
22views

How do I fix this SSL error when making a SQL request from a jetty server

I'm in the process of upgrading a java application. Originally, the application was built with jdk 8 and the server was jetty 9. Since upgrading to jetty 10 and jdk 11, I'm running into an issue when ...
user avatar
  • 1,355
0votes
1answer
23views

How to calculate no. of days in an year in particular time period in sql server

Below is a sample of medical insurance details of members in an organization. And we have to find out no. of days each member is insured in particular year. date format for below data is mm-dd-yyyy ...
user avatar
1vote
2answers
19views

Synapse external table "Unauthorized"

I have created an external table in Azure Synapse from a parquet file stored in an ADLS Gen2 container. I have used the following three queries to create the datasource, the file format and the table: ...
user avatar
  • 11
2votes
1answer
38views

Get the record with the most recent date. SQL

ID Date Value 715 2022-03-20 183.74 715 2022-03-13 86.45 715 2022-03-06 -10.84 715 2022-02-27 291.87 715 2022-02-20 194.58 715 2022-02-13 97.29 715 2022-02-06 0.00 Is there a way to get the ID,...
user avatar
0votes
2answers
77views

SQL merging lines into one line

I have a question about an SQL query. I have a table with these column names: date time route_id name (and other columns not included here): Date route_id Time Name 2022-02-04 320 11:40:00 Taxi ...
user avatar
0votes
0answers
37views

Does the order of the tables in the INNER JOINs and the FROM clause matter?

So assume you perform an inner join between table1 and table2 on column1 Does it make a difference if the table with lower entries is in the FROM-clause? So you start with less results in the first ...
user avatar
  • 15
2votes
1answer
48views

How to eliminate date islands in a logging table?

I have a logging functionality that is executed on each start and end of a table transfer process. It creates a separate entry for both start and stop: Between each distinct table transfer there is a ...
user avatar
  • 45

15 30 50 per page
1
2 3 4 5
6330