![SQLTeam Forum](https://i1.feedspot.com/5178662.jpg?t=1677486286)
SQLTeam Forum
345 FOLLOWERS
Welcome to the Microsoft SQL Server forums at SQLTeam, these forums are for Microsoft SQL Server-specific questions. Ask how to get the last nonnull value when an account is now closed, how SQL STBuffer measures the distance around polygons, how to fix errors, and much more.
SQLTeam Forum
6h ago
Hi experts. Not exactly a SQL Server question but here goes...
My database is being backed up somehow.
Not by an Agent job because this is the Express edition.
I need to find the task that is backing it up so I can find the path to the bak file.
Thanks for any tips.
1 post - 1 participant
Read full topic ..read more
SQLTeam Forum
6h ago
Hi There.
I have tried to get the solution from ChatGPT but it has not worked. I think I need real people to help.
I have a transaction table made up of
RecordId Int
MatterId Int
Date DateTime
Amount Decimal(13.2)
I need a script that will by MatterId, Date find the latest positive transaction per MatterId of a Select list.
If the latest transaction is a Positive then look no further
If the latest transaction is a Negative look for the previous positive transaction of the same amount by Date desc, RecordId desc and exclude those two transactions, then repeat the procedure until a Positive tran ..read more
SQLTeam Forum
16h ago
Hi,
I've got this query but I'm not able to find the results in the right ordering sorting by the date:
select count(*) as numero_righe
,CONVERT (varchar(10), st.CREATEDDATETIME, 103) DataOrdine
CONVERT (varchar(10), st.DELIVERYDATE, 103) DataRichiestaSpedizione
from SALESTABLE st
inner join SALESLINE sl on st.DATAAREAID = sl.DATAAREAID and st.PARTITION = sl.PARTITION and st.SALESID = sl.SALESID left join WHSLOADLINE ll on st.DATAAREAID = ll.DATAAREAID and st.PARTITION = ll.PARTITION and st.SALESID = ll.ORDERNUM
where st.DATAAREAID = '800'
and st.PARTITION = 5637144576
and sl.ITEMID not like ..read more
SQLTeam Forum
4d ago
I am migrating databases to SQL Server 2019, I have a program that reads files to update views in a database, and I am getting an error like 'the name of the object dbo.MyView is not valid (this is translated from Spanish, so in English the exact message may differ a little).
The point is, if I take the query the program is running against the server (a SQL Server 2019) and paste it in SSMS (the MS SQL Server Management Studio) it runs perfectly.
The query is:
ALTER VIEW dbo.MyView AS
SELECT *
FROM DBNAME_C1.dbo.Names
The program is written in C# and runs all ALTER PROCED ..read more
SQLTeam Forum
1w ago
Hello community!
There is a T-SQL that I cannot figure it out how to do it, hope you can point me in the right direction or what would be the best approach (in terms of performance).
Using cursors is not a good idea since the amout of data will be heavy in production.
An industrial application will be populating a table every second during certain time. 2 variables (combinations of filter and tank) are key in order to "group" the data event. Also, an exception would be if time exceeds certain time (in this example "newgroup" knows when a new datagroup should be considered). Later on, there wil ..read more
SQLTeam Forum
1w ago
Hi All,
is that possible to achieve this.
Thanks is advance.
drop table #tab if exists
drop table #result if exists
create table #tab
(SourceAccID varchar(100) , DestinationAccID varchar(100))
create table #Expectedresult(Expres varchar(100))
insert into #tab
select 'A' , 'B' union all
select 'A' , 'C'
select * from #tab
Expected output :
declare @inputvar varchar(100) = 'B'
--when @inputvar as 'B'
Expres
A
C
declare @inputvar varchar(100) = 'C'
--when @inputvar as 'C'
Expres
A
B
declare @inputvar varchar(100) = 'A'
--when @inputvar as 'A'
Expres
B
C
3 posts - 3 participants
Read full topic ..read more
SQLTeam Forum
1w ago
Hello, I hope I'm writing in the right place. I downloaded and installed OCMT (Oracle Client for Microsoft Tools) to connect Powerbi with Oracle database. After doing this the excel query was completely broken. It cannot detect the dates I normally use and I get the error "not a valid month". How do you think I can change how OCMT accesses my Excel or how it detects the date, etc.?
1 post - 1 participant
Read full topic ..read more
SQLTeam Forum
1w ago
CREATE TABLE dbo.tab1
(
idrow INT NOT null IDENTITY,
group1 VARCHAR(10) NOT NULL,
c1 NUMERIC(10,2) NOT NULL,
c2 NUMERIC(10,2) NOT NULL
)
GO
INSERT INTO tab1 (
group1, --group
c1, --numerator
c2 --denominator
)
VALUES
('1', 1, 2),
('1', 2, 1.4),
('1', 3, 5.2),
('2', 1, 0.6),
('2', 4, 0.5),
('2', 3, 0.9)
to store the proportions, the numerator and denominator are stored in the table (there may be several for one group)
. For each group of such values, you need to get the total values in the same form: separately the numerator and separately the denominator
for example, f ..read more
SQLTeam Forum
1w ago
Hello, so I use SQL Server Management Studio and I'm on 20.2. Did they do a update where changing the font setting in a grid doesn't work? By the picture you can see it's set to 6, yet the font displayed doesn't show font size of 6. It's much larger. I also restarted SSMS and it didn't take. If the grid font setting isn't in fonts and colors>grid results then where would that setting be?
Thanks
1 post - 1 participant
Read full topic ..read more
SQLTeam Forum
1w ago
I am trying to create a query that will pull data from three different tables with a fourth table being a date reference table between two of them.
Here is my query so far:
SELECT
rm2.SQSaleKey
, rm2.[Plan Code]
, cd.cd_commission_amount
, cd.cd_commission_statement_date
, cd.cd_commission_payment_date
, dd.MonthYear
, ece.date_ecmpv
, ece.cash_ecmpv
FROM RevOps.dbo.RR_Master2 AS rm2 WITH (NOLOCK)
LEFT OUTER JOIN [SNR-SRTS-Application].dbo.commission_data AS **cd** WITH (NOLOCK)
ON cd.cd_sale_record_key_SelectCARE = rm2.SQSaleKey
LEFT OUTER JOIN [SNR-SRTS-Supple ..read more