Quantcast
Channel: SQLServerCentral » SQL Server 2012 » SQL Server 2012 - T-SQL » Latest topics
Viewing all articles
Browse latest Browse all 4901

Character '*' in float column

$
0
0
Hi everybody,I m an intern in charge of creating an sql server database for production data. We got basically parts numbers and measurements which are float columns. To avoid having any doubt considering blanks (to differentiate between bugs and normal NULLS as far as i understood), the engineering team here decided to put "*" instead of nothing. (Data is csv files).[size="7"] [b]I need to consider this '*' as NULL in a column which has float type.[/b][/size]I tried a trigger "instead of insert" and NULLIF on '*' character but obviously the two parameters of the NULLIF need to be of the same type.[b]I've been told the easiest thing to do would be to modify the data before insert. Is it true[/b]Here is a reduced part of the code :CREATE TRIGGER etoilenulle4 ON dbo.TablebaseAFTER INSERTAS BEGININSERT [dbo].[Tablebase] ([N° CAM] ,[C# fourn] ,[date] ,[heure] ,[banc] ,[N° Pale#] ,[Module_Status] ,[Code défaut] ,[NeutralBefore_13] ,[NeutralBefore_60] ,[S_T4] ,[S13_IminPPV1]) SELECT [N° CAM] ,[C# fourn] ,[date] ,[heure] ,[banc] ,[N° Pale#] ,[Module_Status] ,[Code défaut] ,NULLIF([NeutralBefore_13],'*') ,NULLIF([NeutralBefore_60],'*') ,NULLIF([S_T4],'*') ,NULLIF([S13_IminPPV1],'*')FROM INSERTEDEND

Viewing all articles
Browse latest Browse all 4901

Trending Articles