I have 2 strings Declare @WhenDetails NVarchar(Max) =’07:00:0:0;1:00:1:0;6:00:1:0;10:00:1:0;’ Declare @Dosage NVarchar(Max) =’1.00;2.00;1.00;1.00′ I need to split these 2 string and insert into a …
Tag: .net
Inserting data row into a sql table from another sql table in C#
Context: I’m developing an app for windows in Visual Studio that has a table of stock materials and another of buyed materials, both in a Sql Server. I want that every time you buy something it is added into the stock table. I’m new in using SQL with c# combined. I’m trying this from a tutorial, but does nothing. Not
SQL query with dynamic parameters
I tried to get some data from DB. I need get account information from my table – this type of information will depend on User. If he/she will insert account type = 1 -> he will get this information. How could I create query if it will depend on user: for example user could choose one or more account types
SQL Query to remove duplicated data and take single column sum
I have the following table resulted from but now I want to remove the repeated rows except the Sum of ‘TotalBill’. Answer Use GROUP BY: Note that for the billing date, the two “duplicate” records you have highlighted have different dates. It is not clear which date, if any, you want to report here. I have omitted this column.
dotnet Entity Framework INSERT SELECT FROM other table
I am not an expert on databases and SQL. I am developing a dotnet core application using the Entity Framework to access a (postgresql) database. I have the following tables with the following columns: …
Identity column as part of primary key
Suppose, I have a composite primary key that consists of 3 columns: [ShardKey], [SiteId] and [ServiceId]. Column [ServiceId] is an identity column and should start from 1 for a new combination of [ShardKey] and [SiteId], but SQL server fails – the column [ServiceId] never starts from 1, it just increments its value no matter what the primary key is. I
I have a services table,service has a price, in new order should i save total amount of order or calculate every time services table
do i need to save order amount in orders table or i can calculate everytime from services table against each order ID?
Getting Error While Setting The data to Sql Db, Saying Cannot set the Value of Created at with Null
I am Creating a table in SSMS with the Columns required for the Table and also with the Entitydata mandatory fields Like Id, CreatedAt, UpdatedAt, Version, Deleted. And while setting the data through …
How to force extenal library to use SQL transaction
I have an external library to which I pass an instance of System.Data.SqlClient.SqlConnection and I want to wrap everything that library does on that connection in a transaction. When I was working …
Execute MySQL’s SQL files using .NET
Whenever I make an update to my database (changes in stored procs, changes in tables, new tables ,etc.), I create a new sql file which I run on client’s computer via TeamViewer. I wanted my …