Reputation: 21
Script:
USE Perpustakaan
GO
CREATE FUNCTION com(@id varchar(30), @tipe_item varchar(30))
RETURNS TABLE
AS
RETURN (SELECT left(id_tipe_item,3)+''+left(tipe_item,3)
FROM tm_tipe_item
WHERE id_tipe_item = @id and tipe_item = @tipe_item)
result:
Msg 4514, Level 16, State 1, Procedure com, Line 4
CREATE FUNCTION failed because a column name is not specified for column 1.
Upvotes: 2
Views: 3341
Reputation: 357
Try:
USE Perpustakaan
GO
CREATE FUNCTION com(@id varchar(30), @tipe_item varchar(30))
RETURNS TABLE
AS
RETURN (SELECT left(id_tipe_item,3)+''+left(tipe_item,3) AS MyColumnName
FROM tm_tipe_item
WHERE id_tipe_item = @id and tipe_item = @tipe_item)
Note "MyColumnName" and change it as needed.
Upvotes: 3