在插入中使用用户定义的函数
Use a user defined function in an insert into
我有一个标量值函数,它接受一个值的 varchar(5)
代码并将其转换为另一个值。我试图在 INSERT INTO
:
中使用它
INSERT INTO AccountTable
(
[CustomerName],
[CurrencyAbbreviation]
)
SELECT
customers.CustomerAbbreviation,
funAMSGetCurrency(customers.Currency)
FROM CustomerTable customers
...但是收到一条错误消息说 funAMSGetCurrency
不是内置函数。可以这样翻译吗?
要在 SQL 服务器中调用 user-defined 函数,您需要包含架构,可能是 dbo
:
INSERT INTO AccountTable ([CustomerName], [CurrencyAbbreviation] )
SELECT customers.CustomerAbbreviation,
dbo.funAMSGetCurrency(customers.Currency)
FROM CustomerTable customers ;
我有一个标量值函数,它接受一个值的 varchar(5)
代码并将其转换为另一个值。我试图在 INSERT INTO
:
INSERT INTO AccountTable
(
[CustomerName],
[CurrencyAbbreviation]
)
SELECT
customers.CustomerAbbreviation,
funAMSGetCurrency(customers.Currency)
FROM CustomerTable customers
...但是收到一条错误消息说 funAMSGetCurrency
不是内置函数。可以这样翻译吗?
要在 SQL 服务器中调用 user-defined 函数,您需要包含架构,可能是 dbo
:
INSERT INTO AccountTable ([CustomerName], [CurrencyAbbreviation] )
SELECT customers.CustomerAbbreviation,
dbo.funAMSGetCurrency(customers.Currency)
FROM CustomerTable customers ;