I have a variable
DECLARE url varchar(3000)
and incoming开发者_开发技巧 parameters
scheme VARCHAR(5),
subdomain VARCHAR(55),
domain VARCHAR(55),
tld VARCHAR(55)
yet when i do the following:
SET url = url + ltrim(rtrim(scheme)) + '://';
SET url = url + ltrim(rtrim(subdomain)) + '.';
SET url = url + ltrim(rtrim(domain));
SET url = url+ '.' + ltrim(rtrim(tld));
And insert to the database i get "0"
I'm a newb with sql, what am i doing wrong?
Your initial url variable is NULL
. Think of NULL
like you would an undefined
value in math — when you perform any operations on an undefined value, the result is still undefined. Similarly, if you concatenate NULL
with a string, the result is still NULL
(depending on the options set on the server/database/script). Set it to an empty string to start with and it should work.
精彩评论