![]() |
Transfer SQLServer SQL stored program does no
rotate : SQLServer stored program does not splicing multi- criteria query SQL string ,GHD IV Black Straighteners
splicing written set @ sql = 'select * from table where 1 = 1' if (@ addDate is not null) set @ sql = @ sql + 'and addDate =' + @ addDate + '' if (@ name ''and is not null) set @ sql = @ sql + 'and name = '+ @ name +' ' exec (@ sql) do not use multi- splicing conditions SQL query string solutions The premier was written some code redundancy if (@ addDate is no null) and (@ name '') elect * from table where addDate = @ addDate and name = @ name else if (@ addDate is not null) and (@ name ='') select * from table where addDate = @ AddDate else if (@ addDate is null) and (@ name '') select * from table where and name = @ name another whether (@ addDate is null) and (@ name ='') select * from table The second was written select * from table where (addDate = @ addDate or @ addDate is null) and (name = @ name or @ name ='') The third was written SELECT * FROM chart where addDate = CASE @ addDate IS NULL THEN addDate ELSE @ addDate END,GHD IV Pink Straighteners, name = CASE @ name WHEN''THEN name ELSE @ name END |
All times are GMT. The time now is 02:27 AM. |
Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum