Skip to content
Advertisement

Tag: ssms

using Query one results to run Query two

This code would result with this Result What I would like to do is when the code above gets the results my bottom code reads them and runs them trough its code. The common denominator here would be the account number because its running through a different table I have tried doing this the code below but it doesnt seem

How can I generate an ID column for a column in SQL? [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 6 months ago. Improve this question I have a column that I’d like to generate an ID column for. How can I do this using SQL?.

Correct database after backup

I need some help with a query. Actually we have some wrongs DATA in our database. For some technical reason I restore the backup in another schema. So actually in my Schema1.DB1.TBL1 I got the backed up DATA and in my Schema2.DB2.TBL2 I have the same table but with some wrongs DATA. Could you please tell me an SQL query

execute powershell from SSMS

I am trying to execute as certain xp_cmdshell code: but this is the error that I get: when I try an execute the same thing in powershell I get the expected response(see image) Powershell The expected output from the xp_cmdshell should be a json Answer The error message implies that your command line is being executed via cmd.exe, where &

Get Start and End date from multiple rows of dates, excluding weekends

I’m trying figure out how to return Start Date and End date based on data like in the below table: Name Date From Date To A 2022-01-03 2022-01-03 A 2021-12-29 2021-12-31 A 2021-12-28 2021-12-28 A 2021-12-27 2021-12-27 A 2021-12-23 2021-12-24 A 2021-11-08 2021-11-09 The result I am after would show like this: Name Date From Date To A 2021-12-23 2022-01-03

SQL Row Data to Column Data in Join

Trying to wrap my tiny brain around how to write this query and I am at a loss: Current: How I would like it to look: If someone can point me to a function that could help me with this, it would be much appreciated. I already tried using: max(case when ….) and pivot() which I found in other articles,

Adding x work days onto a date in SQL Server?

I’m a bit confused if there is a simple way to do this. I have a field called receipt_date in my data table and I wish to add 10 working days to this (with bank holidays). I’m not sure if there is any sort of query I could use to join onto this table from my original to calculate 10

Advertisement