I am trying to create a SSIS Package that loops based on the return value of a stored procedure run in the loop. I keep getting a super NOT helpful error of: “Error: 0xC002F210 at Load Order, …
Tag: sql-server
How to set the user rights by passing the database name as Input parameter in a stored procedure?
How to set the user rights by passing the database name as Input parameter in a stored procedure? Declare @username nvarchar(100) Declare @databasename nvarchar(100) set @username = ‘ABC’ CREATE …
Single Item Order – AdventureWorks
I am wondering if my answer works for this problem? The answer I was able to find on the internet seems similar but they join another table which seems ambiguous. Question: A “Single Item Order” is …
Convert/get varchar variable to YYYYMM
I have 4 CTE’s in this table and the third one contains a DATETIME converted to VARCHAR (with format based on the requirement) as startDate in DD/MM/YYYY format. The last cte does calculations based …
Select values with a more recent year and month when both are stored in different columns in SQL Server
The setup in both tables is that year and month are in two seperate columns as numbers. I am trying to select the values from one table that do not exists in the other table (so are more recent date wise). For example: Table1 has values from 2016 until today and Table2 only until end of 2018. So I want
Why we need a primary key?
I am reading about primary keys and at a lot of tutorials, technical blogs etc., and I found that a primary key cannot be null. I think it’s totally wrong because I was able to insert null value in the column. I suppose a primary key can have a not null value only if the column is declared as not
If null in one table select from Other
I have 2 tables inquiry and Application table I want to build a view that contains the user information based on data from these two tables. Example I Have Table Inquiry FirstName, LastName, Address, email I have table Application FirstName, LastName, Address, email Am querying the tables using the email fiel…
Query response in JSON format without column name
My table schema is something like this, Initially, my procedure was returning with data as After processing the data, to the web page is sent as If I use the result will be like So what I need to get is the same response but without column name, as front-end lib uses the JSON array without keys. SQL Server ve…
Converting multiple rows into one row by ID
What I am trying to achieve is group them by id and create a column for the date as well as data. The background of the dataset are it is lab result taken by participant and some test are not able to …
How to calculate difference between 2 time columns in distinct tables?
I need to calculate the difference between EntryHourSchedule (the ideal time) and EntryHourRegistered (the real time) of a worker’s assitance, but both are in 2 different tables: ScheduleDetail (* to …