I have a requirement where from a string of int[] I need to insert all the values of this array into DB. I have tried this solution and it works fine. To achieve this I have converted the int[] to XML in C#, and in SP used this XML variable to fill a table variable and looped over this table
Tag: sql-server
How to get all the dates between the date range (inclusive start_date and end_date) [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question How to get all the dates between start_date and end_date, including start_d…
Transform Columns to Rows dynamically using T-SQL
I have the following table where I need to transform Columns to Rows tbl_Survey: I need to have the following result: To have this result I used the following code: But, my Quest_1, Quest_2, Quest_3 values could potentially be changed / or even added a new once… Are there ways to code them, so it can be…
How to determine the number of days in a month for a given Date Range?
I need to calculate using SQL Query, how many days within a given range fall into each calendar month. I have given 2 dates, which define a date range; for example 2020-01-01 to 2020-08-03. I need to find how many days in that range fall in to each month i.e. how many fall into July, and how many into August.
SQL Server – Generate a column value which satisfy same condition in a day
I have a transaction table (Tran_Table) that contains Account Number, Transaction Date, Transaction Amount. I would like to generate a column that has “Yes” or “No” info in case if a transaction repeated in same day with same amount for same customer. Table and generated value example …
Get last rows before certain value [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question In my table, I have a field RAZ (bit) whose value is 0 except at 5am, 1pm and 9pm when it…
SQL Server Sum specific transaction type amounts
I have a temp table (#general) that contains Account number, transaction type, Amount info as below AccountNumber Tran_Type Credit 96551AQ6 TSCNYAEUQF 0.0000000 96551AQ6 TSCNYAEUQF …
Join repeats rows too many times
List the employees (first and last name in same column), that work in retail or food and drink. Include the building they work in and shop type. This is what I have. Whenever I run it everything repeats so there’s over a hundred rows now. Can anybody help me? EDIT I’ve tried various joins for this…
Combining different SQL requests but they all have same WHERE
I have lots of requests, but they always have the same WHERE, I done request to copy a character by typing his name from a table, so it copy the data from other tables (sometimes need to delete and copy, sometimes only update), but if I want to copy someone’s character, I have to type the names 7 times …
multi condition on different rows
age | name | course | score _________________________ 10 |James | Math | 10 10 |James | Lab | 15 12 |Oliver | Math | 15 13 |William | Lab | 13 I want select record where math >= 10 and lab >11 I write this query but this query does not return any record. I want this result age