Skip to content

Commit

Permalink
Revert "Revert "Revert "Revert "Fix Upgrade Test""""
Browse files Browse the repository at this point in the history
This reverts commit 24d87db.
  • Loading branch information
Nirmit Shah committed Jan 20, 2025
1 parent f3e35c8 commit 82c861a
Show file tree
Hide file tree
Showing 42 changed files with 764 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ select TRY_CONVERT(varchar(30), CAST('11234561231231.234' AS float), 0);
GO
~~START~~
varchar
<NULL>
1.12346e+13
~~END~~

select TRY_CONVERT(varchar(30), CAST('11234561231231.234'AS float), 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DROP TABLE TestResults
DROP VIEW float_char_v1;
DROP VIEW float_char_v2;
DROP FUNCTION float_char_f1;
DROP FUNCTION float_char_f2;
DROP PROCEDURE float_char_p1;
DROP TABLE float_char_t1;
DROP TABLE TestResults_1
DROP VIEW float_varchar_v1;
DROP VIEW float_varchar_v2;
DROP FUNCTION float_varchar_f1;
DROP FUNCTION float_varchar_f2;
DROP PROCEDURE float_varchar_p1;
DROP TABLE float_varchar_t1;
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
CREATE TABLE float_char_t1 (
ID INT IDENTITY(1,1),
FloatValue FLOAT,
Description VARCHAR(100)
);
GO
-- Create dependent objects for testing
-- 1. View that uses CAST
CREATE VIEW float_char_v1
AS
SELECT
CAST(CAST('-123.456' AS FLOAT) AS CHAR(30)) AS CastValue
GO

-- 2. View that uses CONVERT
CREATE VIEW float_char_v2
AS
SELECT
CONVERT(CHAR(30), CAST('-123.456' as FLOAT)) AS ConvertValue
GO

-- 3. Function using CAST
CREATE FUNCTION float_char_f1
(
@FloatInput FLOAT
)
RETURNS VARCHAR(30)
AS
BEGIN
RETURN CAST(@FloatInput AS CHAR(30))
END;
GO

-- 4. Function using CONVERT
CREATE FUNCTION float_char_f2
(
@FloatInput FLOAT
)
RETURNS VARCHAR(30)
AS
BEGIN
RETURN CONVERT(CHAR(30), @FloatInput)
END;
GO

CREATE PROCEDURE float_char_p1
@FloatInput FLOAT
AS
BEGIN
SELECT
CAST(@FloatInput AS CHAR(30)) AS CastResult,
CONVERT(CHAR(30), @FloatInput) AS ConvertResult
END;
GO

-- Insert test data
INSERT INTO float_char_t1 (FloatValue, Description) VALUES
(123.456, 'Standard positive decimal'),
(-123.456, 'Negative decimal'),
(0.0, 'Zero value'),
(1E10, 'Scientific notation - large'),
(1E-10, 'Scientific notation - small'),
(9999999999.99, 'Large decimal'),
(0.000000001, 'Very small decimal'),
(NULL, 'NULL Value')
GO
~~ROW COUNT: 8~~



CREATE TABLE TestResults (
TestID INT IDENTITY(1,1),
TestCategory VARCHAR(50),
TestName VARCHAR(100),
TestScenario VARCHAR(200),
ExpectedResult VARCHAR(50),
ActualResult VARCHAR(50),
TestStatus VARCHAR(20)
);
GO


CREATE TABLE float_varchar_t1 (
ID INT IDENTITY(1,1),
FloatValue FLOAT,
Description VARCHAR(100)
);
GO
-- Create dependent objects for testing
-- 1. View that uses CAST
CREATE VIEW float_varchar_v1
AS
SELECT
CAST(CAST('-123.456' AS FLOAT) AS VARCHAR(30)) AS CastValue
GO

-- 2. View that uses CONVERT
CREATE VIEW float_varchar_v2
AS
SELECT
CONVERT(CHAR(30), CAST('-123.456' as FLOAT)) AS ConvertValue
GO

-- 3. Function using CAST
CREATE FUNCTION float_varchar_f1
(
@FloatInput FLOAT
)
RETURNS VARCHAR(30)
AS
BEGIN
RETURN CAST(@FloatInput AS VARCHAR(30))
END;
GO

-- 4. Function using CONVERT
CREATE FUNCTION float_varchar_f2
(
@FloatInput FLOAT
)
RETURNS VARCHAR(30)
AS
BEGIN
RETURN CONVERT(VARCHAR(30), @FloatInput)
END;
GO

CREATE PROCEDURE float_varchar_p1
@FloatInput FLOAT
AS
BEGIN
SELECT
CAST(@FloatInput AS VARCHAR(30)) AS CastResult,
CONVERT(VARCHAR(30), @FloatInput) AS ConvertResult
END;
GO

-- Insert test data
INSERT INTO float_varchar_t1 (FloatValue, Description) VALUES
(123.456, 'Standard positive decimal'),
(-123.456, 'Negative decimal'),
(0.0, 'Zero value'),
(1E10, 'Scientific notation - large'),
(1E-10, 'Scientific notation - small'),
(9999999999.99, 'Large decimal'),
(0.000000001, 'Very small decimal'),
(NULL, 'NULL Value')
GO
~~ROW COUNT: 8~~



CREATE TABLE TestResults_1 (
TestID INT IDENTITY(1,1),
TestCategory VARCHAR(50),
TestName VARCHAR(100),
TestScenario VARCHAR(200),
ExpectedResult VARCHAR(50),
ActualResult VARCHAR(50),
TestStatus VARCHAR(20)
);
GO
Loading

0 comments on commit 82c861a

Please sign in to comment.