Skip to main content

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
0 votes
0 answers
33 views

Full text search, not finding subitems

I have setup Microsoft SQL Server full text search on a few tables. These tables contain numbers, like phone numbers. If I do a contains search on the full number, it returns matches, but not on a ...
John gougoul's user avatar
0 votes
1 answer
56 views

Optimizing SQL query - joining views of views is extremely slow [closed]

Following question pertains to Microsoft SQL Azure (RTM) - 12.0.2000.8. I have a dataset of invoices that looks like this (raw_data.invoices): invoice_id invoice_date institution billed_to item qty ...
tubular's user avatar
  • 116
0 votes
0 answers
40 views

Row to column conversion in SQL - Dynamic rows [duplicate]

I am trying to convert the rows into column. However, the number of rows/ names are not predictable. it varies each time when I ran it based on my condition. Is there an easy way to pull that info. ...
NotATechSavvyYet's user avatar
-1 votes
0 answers
48 views

Invalid Column with view and multiple schemas [closed]

I have two tables and two schemas created. I've already have a VIEW using both tables and both schemas. But when I try to modify it I receive the error invalid column name. But if execute the query (...
StandardIO's user avatar
0 votes
0 answers
52 views

Rewrite this stored procedure so that it passes up this error through the output variable?

I moved a stored procedure from one database to another and that went fine. I then went to run it and got these errors: Msg 208, Level 16, State 1, Procedure dbo.myStoredProc, Line 159 [Batch Start ...
TheMortiestMorty's user avatar
0 votes
0 answers
41 views

Azure SQL returning different output for query with variable and query with hardcoded values

SQL Server is returning different results for the following two queries that I expect to return the same output: Query 1: DECLARE @year INT = 2024 DECLARE @month INT = 7 SELECT * FROM udf_a(@year, @...
prinkpan's user avatar
  • 2,197
-2 votes
0 answers
41 views

Columns values aggregations code improvement [closed]

I need help with the following situation - I have a table that contains customer name, some static data and then approximately 30 columns with the following values: GOOD, BAD or Nulls. For the ...
user26250433's user avatar
-1 votes
0 answers
39 views

How to transpose rows into columns and ensure all other data matches with the record

I am repeating the question that was previously answered. I need further transposing for columns in the database, hence, I am reposting the question: Parsing First Name and Last Name Example below, a ...
Curious's user avatar
-1 votes
1 answer
53 views

Recursively call the REPLACE function without recursion when the search_expression values are in subsequent rows?

Foreword: I'm on a "try to do everything you know how to do and convert to set based queries". Examples are enhancing basic functions you'd create for cleansing the non-printable characters ...
user2943131's user avatar
-1 votes
0 answers
32 views

Convert datetime2(7) from 2012-07-29 10:53:33.0100000 to 29/07/2012 10:53:33 into my stored procedure

I need to convert datetime2(7) from 2012-07-29 10:53:33.0100000 to 29/07/2012 10:53:33 in my stored procedure in SQL Server. I have this problem with t888_fecact and t888_feciof. I tried this, but ...
Manuel Silva's user avatar
0 votes
0 answers
27 views

How do I pass a parameter value in a function when using a join? [duplicate]

I am finding other solutions. I know my SQL Server query is not correct, but I need help to resolve the issue. Below is my query and what I want to achieve with it for better understanding. Gettring ...
shivchandra kumar's user avatar
0 votes
0 answers
34 views

Create JSON formatted files in SQL Server with .txt extensions

In SQL Server, I need to create JSON formatted files with .txt extensions. Could anyone please advise as to how to do this? I have yet to find a way. First, I select data SELECT * FROM [SQL Server ...
Mahk's user avatar
  • 1
1 vote
2 answers
39 views

Is there a way to retrieve a parent child tree from a single table, with multiple roots and a child_order column?

I have a table that looks like this: CREATE TABLE tbl ( id int, parent_id int, child_order int, name varchar(20) ) Take this as a sample dataset: 1 NULL 0 BtVS 2 NULL 1 ...
Lisa's user avatar
  • 73
0 votes
1 answer
47 views

How to select fields from two tables using LINQ

I am trying to select fields from two tables using the Join clause with LINQ, but I am getting this error: System.InvalidCastException: 'Unable to cast object of type '<>f__AnonymousType213[...
Milie24's user avatar
  • 45
0 votes
0 answers
27 views

Visual Studio Code / function like in SSMS Query shortcut

How to configure VS code keybindings to run directly procedure under shortcut? For ex. I highlight name of object in query and run procedure under shortcut. Or maybe you know alternative soft which ...
Pikaros's user avatar
0 votes
1 answer
50 views

Why MS Access works with SQL server ODBC via internet so slow?

I have an SQL server and MS Access database in the same local network - 1 Gbit/sec. And a lot of tables in that SQL server are linked into MS Access database via ODBC. And a query in the MS Acesss ...
user3565412's user avatar
-1 votes
1 answer
35 views

.NET 8 API with SQL Server: Error During Login Process

I am using .NET 8 to create an API that connects to a SQL Server. My connection string is as follows: configuration["ConnectionStrings:DBConnection"] = "Data Source=\"MYIP, MYPORT\\...
Sergio González's user avatar
0 votes
0 answers
42 views

Return the latest group of records inserted by specifically me into a table along with their ID in the table?

I have a table of Customers, named Customer with the following columns: CustomerID CustomerName ContactNo Address DateCreated 1 Idola Steenson 438614198 Morena 2022-08-14 09:48:00 2 Graham Buckner ...
French Croissant's user avatar
0 votes
0 answers
38 views

Model Binding Issues

**Model Binding Issues ** I'm facing model binding issues in my ASP.NET Core app. The same code works with ResourceManagement1 database but fails with RMT database, though both have identical ...
Anandhavel T's user avatar
0 votes
1 answer
29 views

Does integrated Windows authentication in Ansible require a physical connection to MSSQL server?

Description: I'm currently setting up an Ansible playbook to connect to an MSSQL database server hosted on Windows using integrated Windows authentication. However, I'm uncertain about the requirement ...
Lucifer007's user avatar
0 votes
0 answers
51 views

ERR_CONNECTION_TIMED_OUT When Making POST Request from React to Azure SQL server

I am encountering an ERR_CONNECTION_TIMED_OUT error when trying to send a POST request from my React application to my SQL Server hosted on Azure. The goal is to add data to an Azure SQL database. And ...
EikkaPine's user avatar
1 vote
1 answer
47 views

Joining together 2 tables while joining one table twice with different filters

I have collected data in 2 SQL Server tables: AREAS area a b SHIFTS personal_id date shifttime area 12 2012-01-10 early a 13 2012-01-10 early a 14 2012-01-10 late a 15 2012-01-10 early b I ...
Malte Rothkamm's user avatar
0 votes
1 answer
26 views

How to correctly create the connection to a local SQL Server database using TypeORM for Langchain?

I am trying to connect to my local SQL Server database to use it with Langchain. This is how I am trying to create the connection but keep getting the error shown below when fromDataSourceParams runs: ...
user34534's user avatar
0 votes
1 answer
47 views

Restrict remote login through SQL Server Management Studio without affecting the applications

I have a SQL Server instance running multiple applications in our network using the username user1. All the applications are connected to the SQL Server with this username. I need to block remote ...
user1460901's user avatar
0 votes
0 answers
16 views

Connection between SQL Server and Airflow: [Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)

I am trying to connect SQL Server and Airflow. While trying to establish connection I got the following issue: [Driver Manager]Data source name not found and no default driver specified (0) (...
Diwas Poudel's user avatar
-1 votes
1 answer
44 views

Select maximum values ​and indicate the time (hour)

When I run this SQL script: WITH MaxValues AS ( SELECT Par.CodEst AS 'BNA', Est.GLS_ESTACION AS 'ESTACION', Par.FecMed, DAY(Par.FecMed) AS 'DIA', MONTH(...
Marcela Oyarzo's user avatar
0 votes
0 answers
72 views

Joining 2 huge tables timing out

I have 2 tables with large data. The first one has 580 million rows and the second one has 1200 Million rows. I need to run a query where I join on 3 columns. The 2nd table has multiple rows for the ...
Srkuno's user avatar
  • 11
0 votes
0 answers
46 views
+50

ASP.NET Core Identity ApplicationUser Foreign Key Returning NULL

I have an old ASP.NET MVC project that uses Identity/SQL Server which has worked fine for over a decade and am now attempting to begin a new version that uses ASP.NET Core. I have extended the ...
Nick Reeve's user avatar
  • 1,648
-2 votes
2 answers
49 views

Join two tables with dates and list each changes in the range of dates

I have two tables one for Employee's Name P_NAMES this table contains a historical record of employees if they change their names since they were hired "Effective Date" some have one row ...
Yo Kornholio's user avatar
0 votes
0 answers
25 views

Network error while updating database in Visual Studio nuget package manager

I was watching a tutorial on Blazor Wasm with cookie authentication and I'm getting this error after I ran update-database in the console. A network-related or instance-specific error occurred while ...
Pouya Babaie's user avatar
0 votes
1 answer
56 views

Exclude most recent date when grouping by an attribute through a JOIN

I am looking to exclude the most recent date in my SQL query results. I've done some research on this subject and can only find examples where they GROUP BY an attribute in the originating table. I ...
Crimp's user avatar
  • 428
1 vote
1 answer
38 views

Add column name as XML node and join with other table

I am trying to query table column names as values of the XML Nodes and in the same node add values from the other table. I have found a code in other post that can create nodes from column names but I'...
user76864978's user avatar
0 votes
0 answers
54 views

NullReferenceException at C# SqlConnection Open

From time to time at my Windows 10 system background program in C#, I get a NullReferenceException at this.connection.Open(). My class: private SqlConnection connection; private string ...
Leo Bonhart's user avatar
-3 votes
1 answer
33 views

What happened to my table that I renamed using sp_rename? [closed]

I quickly reviewed the question and answer here: How to change a table name using an SQL query? But I didn't pay attention to the comments in the top answer that said to make sure and remove the ...
Z Ali's user avatar
  • 1
0 votes
1 answer
38 views

SQLKata insert not working with VARBINARY

I have this block of code that inserts data into tables like this: public async Task<int> InsertRowAsync(InsertRowRequest request) { using var conn = _dbConnectionContext.CreateConnection(...
Sergiu's user avatar
  • 432
1 vote
1 answer
67 views

How to optimize a query?

I have a T-SQL query that run during 6 minutes. There is several sub-query on the same table in it. I think it is the cause of the problem. But I have no idea for optimizing it. SELECT dateheure, bac,...
CrocodileDundee's user avatar
-2 votes
0 answers
27 views

SQL Select two lowest values [duplicate]

How to select minimum two values per Name: Name Value a 1 a 2 a 3 b 1 b 2 c 1 d 3 d 4 d 5 d 6 Expected results: Name Value a 1 a 2 b 1 b 2 c 1 d 3 d 4 I'm using sql server 2016
nzskra's user avatar
  • 190
0 votes
1 answer
48 views

STRING_AGG alternative [duplicate]

Our SQL Server version does not support STRING_AGG because of the version Our data is returned like this enter image description here But our requirement is to display it like this: enter image ...
D B's user avatar
  • 3
0 votes
1 answer
45 views

Strategy for cleaning data from multiple sources

I have a table with multiple information referred to the same entity arriving from different data sources. Let's say the table structure is as follows (the actual table has a lot more columns): create ...
AleV's user avatar
  • 335
1 vote
1 answer
42 views

Running an update() with parameters from df.to_dict() causes errors

I am attempting to implement a functionality whereby a table in a SQL Server database is updated as per the contents of a pandas dataframe. I check for overlapping IDs in the database table and in the ...
Malak Khan's user avatar
-1 votes
2 answers
43 views

Get multiple records for each day with a start and end date from existing 1 record

SiteSlot table is having start date and end date Example: Expected Output should be like below We don't have any specified start date and end date and everything will be dynamic dates from the table ...
Sangamesh Arali's user avatar
0 votes
0 answers
34 views

Does using triggers for complex code is convenient and safe or does it have any disadvantages? [closed]

I am writing some database code, when data is inserted into one table, that related processed data should be immediately inserted into another table with scheduler. I'm thinking using triggers for the ...
Rinku's user avatar
  • 1
-2 votes
0 answers
38 views

SQL Server 2022 Express Edition could not install [closed]

I am trying to install SQL Server but I keep getting this error. Unable to install SQL Server (setup.exe) Exit code (decimal ):-2068052377 Error Description: Invalid command line argument. Consult ...
Nischal Maharjan's user avatar
0 votes
0 answers
29 views

SSRS Subscription Jobs in AG

We use SSRS (SQL Server Reporting Services) for reporting purpose. The report server is part of AG (Availability Group). We have one primary and three secondary servers. When we create an SSRS ...
sri.vin's user avatar
-1 votes
0 answers
42 views

Power BI cannot connect to Microsoft SQL Server

I am trying to get data into Power BI by connecting to our Company's Azure SQL Server. But I am getting an error message saying: We encountered an error while trying to connect. Microsoft Sql: Cannot ...
ArNY's user avatar
  • 63
-1 votes
1 answer
80 views

Optimizing SQL join query with date comparison

I have a query that takes around 2 seconds to fetch 16,900 rows: SELECT x.lid FROM schema1.view1 x INNER JOIN schema1.view2 y ON x.cid = y.cid and datediff(day, x.indt, y.linvcy)=0 -- ...
tubular's user avatar
  • 116
0 votes
1 answer
55 views

Auto-update calculated column values

I want to add an additional column (Open Time) in my table which calculates the difference between latest DOOR OPEN and DOOR CLOSE. And is triggered by the message DOOR CLOSE. And I want this column ...
Pragnesh Bhalala's user avatar
0 votes
0 answers
48 views

Connect to Azure SQL Server using windows credentials

I'm trying to connect to Azure SQL using on-prem AD account, which is synched to Azure AD. I am able to connect using the SSMS when I run as a different user but programmatically it doesn't work. It's ...
Ishan's user avatar
  • 4,008
-1 votes
1 answer
66 views

How to remove duplicate in the same row [duplicate]

I have a table with column columna with data in the same row: columna ----------------- a,b,a,b,a,b,a,b I tried this, but it's not good duplicated_rows AS ( SELECT *, ROW_NUMBER(...
mike's user avatar
  • 9
0 votes
0 answers
30 views

Power BI Reports, Azure Synapse link Data from D365 Finance and operations table display method

I am working on a Power BI report using Azure Synapse link to access tables from D365 finance and operations. I am running into scenario where certain fields that I need to recreate in the report are ...
beautifullmind's user avatar

1
2 3 4 5
6710