Viewing 15 posts - 1 through 15 (of 29 total)
assume i have 2 tables
CREATE TABLE #Setup ([PPHProfileNo] INT, [%DPP] MONEY, RangeFrom MONEY, RangeThru MONEY, [%PPH] MONEY)
INSERT INTO #Setup VALUES (1,50,0,60000000,5)
INSERT INTO #Setup VALUES (2,50,60000001,190000000,15)
INSERT INTO #Setup...
April 25, 2022 at 4:39 am
i mean if i put 55 millions, then you should give the output of 3 rows where sum all used columns is 55 millions. used column is based on the...
April 24, 2022 at 10:46 pm
okay..
i will take this query for my program, without consider this query is not recursive. this just using normal loop. if can made recursive it will be better.
Thanks..
I have...
September 7, 2020 at 1:09 am
gentong.bocor wrote:yes, this query can't be run on 2008..
You mean the queries posted here, or it's not possible at all? There's got to be a way
I mean, the query...
September 2, 2020 at 4:39 am
Here's my partly done solution. It needs CROSS APPLY the projections
drop table if exists #Consumption;
go
CREATE TABLE #Consumption(
MeterNo VARCHAR(10),
PERIOD SMALLDATETIME,
Amount MONEY);
go
INSERT...
September 2, 2020 at 12:54 am
yes, this query can't be run on 2008..
September 2, 2020 at 12:46 am
Anyone?
September 1, 2020 at 12:11 pm
yessss... !!
that's what i want.. but unfortunately that code only can be run using SQL2012. is there any code using cte which simplified loop for each rows but running in...
May 6, 2020 at 4:13 am
@Eirikur Eiriksson
i see, your code may get wrong result if called with week no. 1
calling SELECT * FROM dbo.ITVFN_CALENDAR_YEAR(2016) AS INC
WHERE INC.WEEK_NO = 1 may get 2 days, 2016-01-01 &...
September 22, 2016 at 8:22 pm
Eirikur Eiriksson (9/22/2016)
😎
USE TEEST;
GO
SET NOCOUNT ON;
GO
CREATE FUNCTION dbo.ITVFN_CALENDAR_YEAR
(
@YEAR INT...
September 22, 2016 at 8:01 pm
Eirikur Eiriksson (9/22/2016)
😎
USE TEEST;
GO
SET NOCOUNT ON;
IF OBJECT_ID(N'tempdb..#tamp') IS NOT NULL DROP TABLE #tamp;
CREATE TABLE #tamp
( WeekNo INT,...
September 22, 2016 at 4:14 am
GilaMonster (9/22/2016)
The stuff you posted in the #tamp table, do you have that data at the start, or is it part of what you want to generate?
the #tamp table is...
September 22, 2016 at 4:09 am
J Livingston SQL (9/22/2016)
gentong.bocor (9/22/2016)
i give u temporary table for u try..
CREATE TABLE #tamp
( WeekNo INT, FromDate SMALLDATETIME, ThruDate SMALLDATETIME, Period VARCHAR(6) )
INSERT INTO #tamp VALUES (36,'2016-08-29','2016-09-04','201609')
INSERT INTO #tamp VALUES...
September 22, 2016 at 3:50 am
actually i can loop datetime variable using while, and increment with 1 days through loop.
but i wanna hear any idea which simplify the code..
if u said using cte will...
September 22, 2016 at 3:39 am
Viewing 15 posts - 1 through 15 (of 29 total)