gtjr921
Programmer
- Aug 30, 2006
- 115
I have a SP that gets data from parameters in Asp.net the .net form passes data from an excel spreadsheet.
This all works except that when it inserts any of the fields that contain numbers they end up in sql looking like 9.37123e+009 or 4.581e+008
I have tried cast and convert to no avail.
The three fields I am trying to insert numeric data to all have nvarchar(50)
I believe SQL is seeing the the incoming data as float
even though i have the data in excel as general or text.
here is my sp
This all works except that when it inserts any of the fields that contain numbers they end up in sql looking like 9.37123e+009 or 4.581e+008
I have tried cast and convert to no avail.
The three fields I am trying to insert numeric data to all have nvarchar(50)
I believe SQL is seeing the the incoming data as float
even though i have the data in excel as general or text.
here is my sp
Code:
ALTER PROCEDURE [dbo].[mySP]
@FirstName nchar(255),
@HomeAddress nvarchar(256),
@HomeCity nvarchar(256),
@HomeState nvarchar(256),
@HomeZIP nvarchar(255),
@HomePhone nvarchar(50),
@RoleName varchar(256)
AS
Begin
Set NoCount on
Declare @TelephoneID int
Select @TelephoneID = Count(TelephoneID)+1 from app_TelephoneDetails
Insert into app_TelephoneDetails (TelephoneID, Telephone,
FirstName, RoleName,
HomeAddress,HomeCity,
HomeState,HomeZIP,
HomePhone,LastModified,
StatusCode, LastUser,Active)
values
(@TelephoneID, CAST(@HomePhone AS nvarchar(50)),
@FirstName,@RoleName,
@HomeAddress,@HomeCity,
@HomeState,CAST(@HomeZip AS nvarchar(50)),CAST(@HomePhone AS nvarchar(50)),
{ fn NOW() }, 'Open', 'admin', -1)
End