Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1875
  • Last Modified:

Stored Procedure Input Parameter

Hi all, i'll put this question in a simple way..
I have this stored procedure:

-------------
CREATE PROCEDURE SPTEST @STR varchar(1000)
AS
PRINT @STR
GO
-------------


If in query analizer or in asp code i try this:
exec SPTEST "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678X"

I receive an error:
The identifier that starts with '12345678.....345678' is too long. Maximum length is 128.



If i remove the last char ('X') in the Input Parameter it works!
Is there a way to pass an input parameter bigger than 128 length?

Thanx in advance!
0
sammurai
Asked:
sammurai
1 Solution
 
TimCotteeCommented:
Hi sammurai,

You are using " (double quote characters) instead of ' (single-quote characters) This  means that SQL query parser is interpreting your string as a column name rather than as a string. The maximum length for a column name is 128 characters which is why you get the error. Replace your " with ' and it should be fine.

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 
ashishjjCommented:
Hi,

  Try this

exec SPTEST '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678X'

Do not put double quotes, just single quotes

Ashish
0
 
sammuraiAuthor Commented:
Thanx a lot!
It worked
0
 
NANDA2002_USCommented:
I want to pass like this:  How??

"WHERE Location IN ('Beaumont Royal Oak','Bgread Hospital','CoimMedicalCenter','Crittenton Hospital','Gladwyn Ostepathic Care Center','Government Hospital','Patient Home','ABC HOSP','St Joseph Mercy Hospital') AND provider_code IN ('Tina','Davis','TCG','DG','MVK','Larson','DB','Dr Powell','SMITH','PRO1')"

Thanks In Advance
-Nanda
0
 
NANDA2002_USCommented:
Opps...

Its one of the paramenter for a stored procedure

Im Generating a Big Where class from the FrontEnd  Based on several Filter Conditions & Callin a stored procedure with this where class as parameters..

How to handle this..      

0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now