0

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]
Renats Stozkovs
  • 2,549
  • 10
  • 22
  • 26
shafna
  • 1
  • Please read [How to ask a good question](http://stackoverflow.com/help/how-to-ask) and [The perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and how to create a [Minimal, Complete and Verifiable example (MVCE)](http://stackoverflow.com/help/mcve) to improve your question and chances to get an answer. – Douwe de Haan Apr 26 '17 at 10:15

1 Answers1

0

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]
Nikhil Fadnis
  • 787
  • 5
  • 14