All Questions
7,262
questions
-3
votes
1
answer
80
views
I cannot modify the table in my database with C# [closed]
I created a database and a table in Microsoft SQL Server, and I want to do some experiments with it in C#. I successfully connected to my database and I can read the first row of the table, too. But ...
3
votes
1
answer
88
views
Join tables with condition that all row values are unique
I have tables Machine and Inventory. In table Machine I have last running inventory properties. In table Inventory, I have new inventory id and properties (Not yet run in machine).
I have to return a ...
1
vote
1
answer
95
views
How to properly manage and dispose SqlConnection with SqlCredential in EF Core using Dependency Injection?
I am working on an ASP.NET Core project where I am using SqlCredential for database authentication, provided by a SqlCredentialProvider which is designed as a singleton to ensure a single instance ...
0
votes
2
answers
95
views
Convert a string to base 64 using T-SQL
I'm having the issue while converting the string to base 64 for encoding using T-SQL. As I use chatgpt to search and some function like
SELECT BASE64_ENCODE (CAST ('hello world' AS varbinary))
SELECT ...
0
votes
1
answer
65
views
Error in Uploading an Image to a localhost SQL server using ASP.NET Core and C#
I want to send image itself to a SQL Server on localhost (send an image from my computer to localhost using ASP.NET Core web service written in C#).
I tried this in my client side:
OpenFileDialog opf =...
0
votes
2
answers
113
views
Why isn't searching on an indexed column faster than a string comparison?
I was asked for a demonstration of how searching on an indexed column is faster than searching for a string prefix, so I created a quick test but the results were surprising and I can't see why.
The ...
-2
votes
2
answers
101
views
Get particular value from string in SQL query
I am working with a stored procedure where I am getting a string with different characters I want to get a value at last index
[AV] Z_Prem_454-3000_XXXXX_800+ [InstalmentScheme 6]
above is the string ...
-2
votes
1
answer
84
views
How do I convert this Knuth hash code in C# to the SQL equivalent?
Can anyone help me to convert the C# code below (Knuth hash) to the SQL equivalent?
/// <summary>
/// https://stackoverflow.com/a/9545731
/// </summary>
static string CalculateHash(string ...
1
vote
1
answer
242
views
Dapper how to pass object with list of objects into stored procedure
I have a problem with executing an existing stored procedure using Dapper. The stored procedure takes some parameters and list of user-defined type object. I mimicked the required parameters in C#, ...
0
votes
1
answer
66
views
Is there a way to enforce a specific JSON structure for JSON column?
I have a column in my table that will hold JSON objects. I currently have the column defined as MY_JSON_COLUMN NVARCHAR(MAX)
Is there a way to make sure the JSON adheres to a specific structure?
For ...
0
votes
2
answers
82
views
Bulk Insert not respecting Id column with Linq2Db and Entity Framework Core
I am using LINQ to DB with the linq2db.EntityFrameworkCore for bulk-entering of some records.
With EF, I just save the records with a 0 in the Id property and they use the sequence I set up on the ...
-1
votes
1
answer
106
views
How to correctly pass nvarchar parameter to SQL Stored Procedure from .NET Application?
I would like to execute a SQL stored procedure (SP) with parameters. However, I am having difficulties passing nvarchar (string) parameter called "office" to the SP.
If I want to execute the ...
-1
votes
2
answers
112
views
Query (or LINQ in Entity Framework) for getting user's rank
I have a SQL Server database with a table named Users.
This table has 2 columns: XP (int32) and Name (nvarchar).
I need a SQL query or Linq (this is better because I'm using Entity Framework in C#) ...
1
vote
0
answers
65
views
Table Design for Calculating Median Over User-Defined Period from Pre-Processed Data
I’m working with a table that contains pre-processed data from several other tables. This data is segmented by a time period (like a day) to speed up queries that could take minutes if I had to ...
0
votes
0
answers
45
views
SQL stored procedure to add dynamic rows group by page to material column
I need the Page row dynamically after each group of Material row. Some of Materials are grouped with a name in the Page column.
SQL query:
BEGIN
SET @SQL = '
WITH RowData AS (
...