database(ETL) testing using sql server

153 Views Asked by At

for ETL TESTING:

when transforming from source table to destination or war house, if a column EMPLOYEENAME is null, replace it with "" and truncate to 50 characters in sql server 2014 i got a query to replace null with "". but i have to truncate the data length if data is null.

SELECT  
    [EmployeeID], 
    ISNULL( [Employeename],'""') AS [Employeename] 
FROM [dbo].[Employees]
1

There are 1 best solutions below

0
Nikhil Fadnis On

As per my understanding of the question asked..

you need to select records and display " " (Blank) in case of Null and trim it to 50 characters for all records extending above it.

   SELECT  
   [EmployeeID], 
       left(ISNULL( [Employeename],'""'),50)   AS [Employeename]
          FROM [dbo].[Employees]