Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting Float fields as part of an Insert
Message
From
18/11/2016 13:48:41
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
OS:
Windows Server 2012
Miscellaneous
Thread ID:
01643678
Message ID:
01643680
Views:
33
Hi Martina,

My DML has to be scripted to hand over to execute in a production system. I cannot make those changes that way in this system. Once I create a dml script, I test execute this in the stage environment and validate before handing the script over to change management to run in production.

Thanks

>Hi,
>
>Why you dont' use SPT with bind parameters?
>
>
>?SQLEXEC(MSSQLHandle,"SELECt * FROM sourcetable","xxc")
>
>SELE xxc
>SCAN ALL
>?SQLEXEC(ORACLEHandle,"INSERT INTO desttable (Unit_ID, Description, QuantityFK, Factor, Multiplier, Last_Update) VALUES (?xxc.Unit_ID, ?xxc.Description, ?xxc.QuantityFK, ?xxc.Factor, ?xxc.Multiplier, ?xxc.Last_Update)")
>ENDSCAN
>
>
>MartinaJ
>
>>I am trying to create insert statements from a table of data from SQL Server to execute against an Oracle table of similar structure. I am struggling with a couple of float columns that seem to be converting to scientific notation. I do not want the values converted. SSMS query displays these values straight up so why can't I get them straight up?
>>
>>This is my query to get my data out as Insert Statements but with no convert or cast causes an error.
>>
>>SELECT 'INSERT INTO UCS_UNIT (Unit_ID, Description, QuantityFK, Factor, Multiplier, Last_Update) VALUES(''' +
>>	REPLACE(CAST(UnitID AS VARCHAR(36)),'-', '') + ''', ''' + Description + ''', ''' + REPLACE(CAST(QuantityFK AS VARCHAR(36)),'-', '') +
>>	''', ''' + Factor + ''', ''' + Multiplier +
>>	 ''', TO_DATE(''' + CONVERT(VARCHAR(19), LastUpdate, 121) +  ''', ''YYYY-MM-DD HH24:MI:SS''));' AS UCS_Unit
>>FROM uom.Unit WHERE Active = 1;
>>
>>
>>
>>Trying to do some Cast and Convert comparisons gives me varying output but none are what I need.
>>
>>select UnitID, Factor, CONVERT(VARCHAR(50), Factor, 128) As ConvertFactor,
>>CAST(Factor AS VARCHAR(50)) As CastFactor,
>>CAST(CAST(Factor AS Float) AS VARCHAR(50))AS CompountFactor
>> from uom.Unit where QuantityFK = 'D9930486-53C3-41BD-9444-010E931EF061';
>>
>>
>>
>>
>>2551443.86974022	           2.55144386974022E6	      2.55144e+006	    2.55144e+006
>>86400	                          86400	                              86400	            86400
>>3153600000.3744	          3.1536000003744E9	      3.1536e+009	    3.1536e+009
>>157679960.138506	          1.57679960138506E8	      1.5768e+008	    1.5768e+008
>>2629822.96584	          2.62982296584E6	              2.62982e+006	    2.62982e+006
>>
>>
>>
>>This is a one time data load that I won't be doing again. I wanted something down and dirty.
>>Only between 3,000 and 4000 rows.
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform