Select some data using ‘IN’ clause, the result should keep the same order as the in conditions.
SELECT SECCODE, SECSNAME FROM SECURITY
WHERE SECCODE IN
('1U68',
'1F77')
ORDER BY
CharIndex(LTRIM(RTRIM([SECCODE])), '1U68, 1F77')
In MySQL, you can use “Order By Field()
http://www.electrictoolbox.com/mysql-order-specific-field-values/
Kindly remind you:
Do trim the join fields for your ‘MergeJoin’:
Otherwise it may take hours to debug!!
SELECT LTRIM(RTRIM(seccode)) AS seccode….
http://msdn.microsoft.com/en-us/library/ms190329(SQL.90).aspx
Returns the number of bytes used to represent any expression.
SQLs:
DECLARE @STR VARCHAR(32);
SET @STR = ’12 ‘
SELECT LEN(@STR) — 2
SELECT DATALENGTH(@STR); –6
需求:
SELECT
ACCOUNT,
DTCREATED
FROM USERS
WHERE DTCREATED > ?
? 来源于某Variable
解决方案:
1. 输入SQL:
注意 Data access mode不是: from variabel。
2. 点击Parameters… 在弹出对话框中选择变量即可。
1. 修改SQL Task 的Result Set属性
2. 在ResultSet tab下选择要输出的Column及对应的Variable:
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.