Error: Only constants, constant expressions,

May 26, 2009 at 04:46:58
Specs: Windows Vista, pentium/2gb
Hello all,

I am trying insert some values in a table in Sybase database, but i receive the following error:

1> Insert into account_hierarchy (company_stablekey,provider_id,account_name,msisdn,parent_msisdn,up_account_allowed,is_used) values (45959582,1,L10CUSTID2054936,550100102765,NULL,0,1)
2> go
Msg 128, Level 15, State 2:
Server 'SQL_ADM', Line 1:
The name 'L10CUSTID2054936' is illegal in this context. Only constants, constant expressions, or variables allowed here. Column names are illegal.

Then i tried execute a procedure that do it, but i received a new error:

1> execute proc_ins_account 45959582, 1, L10CUSTID2054936, 550100102765, NULL, 0, 1
2> go
Msg 257, Level 16, State 1:
Server 'SQL_ADM', Procedure 'proc_ins_account':
Implicit conversion from datatype 'INT' to 'VARCHAR' is not allowed. Use the CONVERT function to run this query.
Msg 257, Level 16, State 1:
Server 'SQL_ADM', Procedure 'proc_ins_account':
Implicit conversion from datatype 'NUMERIC' to 'VARCHAR' is not allowed. Use the CONVERT function to run this query.
(return status = -6)

Now, the problem is with L10CUSTID2054936 and Null values ...

Follow bellow the structure of this procedure:

3> sp_helptext proc_ins_account
4> go
# Lines of Text
---------------
6

(1 row affected)
text
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--
-- Insert an account
--
create proc proc_ins_account(
@company_stablekey StableKey,
@provider_id ProviderId,
@dname DName,
@account_name AccountName,
@msisdn MsIsdn,
@up_
account_allowed tinyint,
@is_used tinyint)
as
declare @dname_msisdn MsIsdn,
@parent_msisdn MsIsdn,
@dname_account_name AccountName,
@ret_value int

-- lookup parent MSISDN

exec @ret_value = proc_dname_analysis
@company_stablekey,
@provider_id,
@dname,
@dname_msisdn output,
@parent_msisdn output,

@dname_account_name output,
"new"

if (@ret_value = 0) and (@account_name = @dname_account_name)
begin
-- New account looks good
insert into account_hierarchy
(company_stablekey,

provider_id,
account_name,
msisdn,
parent_msisdn,
up_account_allowed,
is_used
)
values
(@company_stablekey,
@provider_id,
@accou
nt_name,
@msisdn,
@parent_msisdn,
@up_account_allowed,
@is_used
)

return 0
end

-- Something went wrong
return @ret_value

(6 rows affected)
(return status = 0)
1>


Can anyone help me ?


See More: Error: Only constants, constant expressions,

Report •


#1
May 26, 2009 at 06:58:24
did you try enclosing the inserted values in single quotes?

Report •

#2
May 27, 2009 at 03:05:53
:) thanks jon

Report •

Related Solutions


Ask Question