开发者

MySQL to SQL Server select statement

开发者 https://www.devze.com 2023-03-10 00:12 出处:网络
I am converting mysql sprocs to SQL Server.I\'ve come across a select statement in mysql that I don\'t quite understand what it\'s doing and my google-fu/so-fu has failed me.Here is the gist of it:

I am converting mysql sprocs to SQL Server. I've come across a select statement in mysql that I don't quite understand what it's doing and my google-fu/so-fu has failed me. Here is the gist of it:

    SELECT AccountType = dbo.functi开发者_JAVA百科onToGetAccountType() FROM AccountLookup

I don't have the ability to debug the original mysql. I do know that the function only returns a single value.

Is the mysql statement assigning a default value to 'AccountType' in the event there are no rows in the AccountLookup table?

Thanks for your time.


The select statement is executing the function dbo.functionToGetAccountType() and aliasing the column as AccountType. It could be re-written as:

SELECT dbo.functionToGetAccountType() as AccountType
FROM AccountLookup 
0

精彩评论

暂无评论...
验证码 换一张
取 消