sql server - Can I use DT_STR in T-SQL -


i using ssis in have code use parsing files year / month , day in expression builder use:

(dt_str,4,1252)month( dateadd( "dd", -1, getdate() )) gets month (dt_str,4,1252)day( dateadd( "dd", -1, getdate() )) gets day (dt_str,4,1252)year( dateadd( "dd", -1, getdate() )) gets year 

however, when coding, paste code sql server query window well, dt_str seems specific ssis ?

is there equivalent replacement, or why can't use in t-sql?

edit:

ok, see code not all portable t-sql , nor used correctly month , day never being length of 4

(dt_str, 4, 1252) year (dateadd ( "dd", 0, getdate())) + right ("0" + ltrim ((dt_str, 4, 1252) month (dateadd ("dd", 0, getdate()))), 2) + right ("0" + ltrim ((dt_str, 4, 1252) day (dateadd ("dd", -1, getdate()))), 2) + ".txt" 

the ssis expression language not tsql. might ask why can't paste motorola 68k assembly code r compiler? dt_str integration services data type. approximate sql server data type varchar(n).

if question how verify expressions correct, assign them variable , can inspect them during package execution setting breakpoint , looking @ locals window. variables window use during development not going contain run time values. complex expressions built in task's properties nightmare troubleshooting there no facilities provide inspection.

finally, code above assigns length of 4 entities never 4 spaces in length: month , day.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -