Friday, January 31, 2020

Get only numeric column values SQL




SELECT column1 FROM table WHERE ISNUMERIC(column1) = 1

OR

SELECT column1 FROM table WHERE column1 not like '%[^0-9]%' and column1 != ''

Thursday, January 2, 2020

Flat File destination

With the help of expressions you can make connection dynamic.
Select your flat file connection from Connection Managers pane. In Properties pane, click on Expression(...). Then choose ConnectionString Property from drop down list and in Expression(...) put your expression and evaluate it.
Expression build -

For day : (DT_STR,4,1252)DAY( DATEADD( "dd", -1, getdate() ))
For month: (DT_STR,4,1252)MONTH( DATEADD( "dd", -1, getdate() ))
For Year:  (DT_STR,4,1252)YEAR( DATEADD( "dd", -1, getdate() )
Example expression(you need to tweak as per your requirement) -
which is giving E:\Backup\EmployeeCount_20140627.txt as value.

Please note - You need a working flat file connection so first create flat file connection whose connectionString property is then going to be replaced automatically by expression.

You can follow these step by step articles as well.
enter image description here
enter image description here