2

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.