logo
down
shadow

TSQL QUESTIONS

Pivot account date list to account start and end dates with missing dates
Pivot account date list to account start and end dates with missing dates
I think the issue was by ths following , I have this requirement to convert a list of account active dates to provide the active start and end dates for each sequence of dates and the days between the dates. For example, this is the list of active da
TAG : tsql
Date : January 02 2021, 06:48 AM , By : Binary
TSQL datediff returning same result for week and days
TSQL datediff returning same result for week and days
it helps some times "w" is not shorthand for weeks, it is an alias for WEEKDAY. Since Weekday does not really make sense as a datediff option, I would guess that this is treated like days under the hood.If you want weeks difference, you need to use "
TAG : tsql
Date : January 02 2021, 06:48 AM , By : Prabhjot Khurana
How does one Create a Parameterized Recursive CTE to flatten a heirarchy within a Scalar Function?
How does one Create a Parameterized Recursive CTE to flatten a heirarchy within a Scalar Function?
To fix this issue As stated, I'm not able to test this, but this is what I'm suggesting you change:
TAG : tsql
Date : January 01 2021, 06:35 AM , By : user3090798
DAX expression to isolate 2 columns from a table and filter the result table based on another column
DAX expression to isolate 2 columns from a table and filter the result table based on another column
it should still fix some issue In the Modelling tab in Power BI, click on New Table and use the below expression:
TAG : tsql
Date : December 27 2020, 04:58 PM , By : user3086816
How can I turn the next query into Power Query, I can only perform the first part
How can I turn the next query into Power Query, I can only perform the first part
wish of those help How can I turn the next query: , If you prefer single step:
TAG : tsql
Date : December 25 2020, 09:01 PM , By : user3079083
A T-SQL process to identify the total duration or number of days of all "cases" within a specified time period
A T-SQL process to identify the total duration or number of days of all "cases" within a specified time period
To fix this issue I could really do with some help and intend to be active in this community and help others in return. I am a SQL developer using MS SQL Server for the last two years but I've hit a roadblock on this one. Imagine the scenario you hav
TAG : tsql
Date : December 25 2020, 02:01 PM , By : isefka
TSQL: Trying to Streamline/Optimise my Stored-Procedure
TSQL: Trying to Streamline/Optimise my Stored-Procedure
help you fix your problem You can put your CASE expression in a CTE and refer to it multiple times by its alias in the query to follow. However, since your CASE expression for F_YEAR is different from the one for F_Quarter there is no way to only use
TAG : tsql
Date : December 25 2020, 01:30 PM , By : user3075219
How to correct this if exists query?
How to correct this if exists query?
hope this fix your issue Do you know why this piece of code returns syntax error? A subquery executes properly. , Found one problem and fixed it in the following:
TAG : tsql
Date : December 23 2020, 03:01 PM , By : user3063575
Have Datetable with dates and if business day, need to find the 11th business day after a date
Have Datetable with dates and if business day, need to find the 11th business day after a date
I wish this helpful for you 1st step was to create a date table. Figuring out weekday verse weekends is easy. Weekdays are 1, weekends are 0. Borrowed someone else's holiday calendar, if holiday 1 else 0. Then Business day is Weekday-Holiday = Busine
TAG : tsql
Date : December 18 2020, 10:25 AM , By : Auxis
Issue with PK violation on insert
Issue with PK violation on insert
this will help maybe someone or something with enough permissions made a mistake by reseeding?As simple as this:
TAG : tsql
Date : December 15 2020, 09:15 AM , By : 3ler
How to separate Columns inside concat function with Hyphen and Comma?
How to separate Columns inside concat function with Hyphen and Comma?
To fix this issue This is the error i am getting while creating the Stored Proc below : Incorrect syntax near ','. I am trying to separate columns inside CONCAT function with Hyphen and Comma but if I remove Hyphen and Comma it works. I am trying to
TAG : tsql
Date : December 01 2020, 04:50 PM , By : user3044996
What is wrong with this SQL WHILE LOOP?
What is wrong with this SQL WHILE LOOP?
I hope this helps you . Once when @wDate reach @fcStart looks like you never reset @wDate to initial state So next loop run againYou need some how to reset @wDate for next loop
TAG : tsql
Date : November 06 2020, 03:01 PM , By : Yarin Azoulay
TSQL - Add missing dates
TSQL - Add missing dates
help you fix your problem James,You may find it helpful to build a CTE table with one row for all of the possible dates between a range (i.e. MIN and MAX dates from your fact table), and then LEFT JOIN to it to find missing dates. You may also want t
TAG : tsql
Date : November 04 2020, 03:01 PM , By : Ashiq
TSQL: transpose last 3 columns into rows?
TSQL: transpose last 3 columns into rows?
like below fixes the issue There are many possible solutions, but I would personally use a CTE. For the CTE to work, you'll need to include a ; at the beginning to close any previous statements. I assumed a full outer join just in case any EntrantID
TAG : tsql
Date : October 09 2020, 05:00 AM , By : Chaitanya Krishna
Multiple Self-Joins to Find Transitive Subsets (cliques)
Multiple Self-Joins to Find Transitive Subsets (cliques)
I wish this help you Times ago I needed to create clusters of data using transitive closure. The best way to do that was using SQLCLR. Here's the GitHub code (article to detailed link is there too)https://github.com/yorek/non-scalar-uda-transitive-cl
TAG : tsql
Date : October 08 2020, 07:00 PM , By : 9cindy
Reuse WITH table definition across multiple code blocks
Reuse WITH table definition across multiple code blocks
this will help A common table expression can only be used within the scope of a single statement:
TAG : tsql
Date : October 05 2020, 06:00 PM , By : Aleksa Zelić
Can't get missing days to show zero
Can't get missing days to show zero
This might help you Your where clause is effectively changing your left join to an inner join. That is because a left join returns nulls for rows that can't be found on the right table, and null compared to anything will always return unknown which i
TAG : tsql
Date : October 04 2020, 10:00 PM , By : Ganesh Mohite
How to unpivot the following columns?
How to unpivot the following columns?
I wish this helpful for you I have a table Tabel1 with columns id, data1, value1A, value1B, date2, value2A, value2B. , You can accomplish this by using cross apply:
TAG : tsql
Date : October 04 2020, 01:00 AM , By : Phan Văn Đa
TSQL convert numbers to time
TSQL convert numbers to time
hop of those help? I have a time field which is storing numbers in '49235062'. Can these be converted to an actual readable time? , Just a guess, but is this milliseconds from midnight? Example
TAG : tsql
Date : October 01 2020, 10:00 AM , By : Zaneta
How can I pivot multiple value columns at once?
How can I pivot multiple value columns at once?
it should still fix some issue Here is a working sample of the PIVOT optionExample (or dbFiddle)
TAG : tsql
Date : September 29 2020, 06:00 PM , By : Jessica
Merge - when matched then do nothing
Merge - when matched then do nothing
hop of those help? I'm not sure I'd bother with all of the overhead that comes with a MERGE statement. See Use Caution with SQL Server's MERGE Statement.You can get everything you need with an explicit transaction.
TAG : tsql
Date : September 28 2020, 06:00 AM , By : omkar bonthu
I need a type of group-sort that I couldn't figure out with ROW_NUMBER on T-SQL
I need a type of group-sort that I couldn't figure out with ROW_NUMBER on T-SQL
around this issue I have a table with a table_id row and 2 other rows. I want type of numbering with row_number function and I want result to seem like this: , Using LAG and a windowed COUNT appears to get you what you are after:
TAG : tsql
Date : September 27 2020, 02:00 PM , By : ricomnc
Error while finding the time difference in SQL Sybase using DATEDIFF function
Error while finding the time difference in SQL Sybase using DATEDIFF function
wish of those help You need to utilise a standard date-time format, for it to work. For example, see following query:
TAG : tsql
Date : September 25 2020, 03:00 PM , By : Tara
SQL Server LEN function reports wrong result
SQL Server LEN function reports wrong result
this will help Not a bug, it's how LEN works. LEN:
TAG : tsql
Date : September 23 2020, 07:00 PM , By : Andrew
Combine query in the TSQL
Combine query in the TSQL
With these it helps I am trying to combine the SQL queries and getting the below error. , SET the variable value :
TAG : tsql
Date : September 22 2020, 01:00 PM , By : Wiz Khalifa
T-SQL date between query
T-SQL date between query
this one helps. SQL Server 2005 is long out of support, why are you still using it? If you really are still using SQL Server 2005 it's long past time you upgrade and you really need to look at upgrade paths asap. No supported versions of SQL Server s
TAG : tsql
Date : September 22 2020, 06:00 AM , By : Michael Wang
result of sp_executesql in a variable
result of sp_executesql in a variable
I wish this helpful for you How can I get the output of the below query in a variable without temp table? , Assuming that you get a singleton value from your dynamic statement:
TAG : tsql
Date : September 21 2020, 09:00 AM , By : Wencong Xu
Creating and inserting into a DB using Dynamic SQL
Creating and inserting into a DB using Dynamic SQL
I wish this help you After fixing your SQL to not be a huge injection issue, by properly quoting your objects, you need to separate the statements into 2 commands. Then you can CREATE your database in one command, and then INSERT in another.
TAG : tsql
Date : September 19 2020, 08:00 PM , By : zamartz
shadow
Privacy Policy - Terms - Contact Us © festivalmusicasacra.org