我希望定义一个函数,并且从该函数中返回一个简单的字符串值,函数定义如下:
CREATE FUNCTION getCustomerType (@orderNumber INT)
RETURNS VARCHAR(30)
AS
Return
(
select custtype from Customer c
join order o on o.customerid = c.customerid
where o.orderNumber = @orderNumber
)
GO
select getCustType(1063609)
应该返回下单号为#1063609的客户类型,但未能成功
dbo.getCustType
或者正确的模式。 - Martin Smithdbo.getCustType
或者你自定义的模式。 - LamakgetCustomerType
,为什么要调用getCustType
呢? - Andriy M