Monday, March 12, 2012

How long is a SQL statement allowed to be?

I am trying to make the following SQL statement, but there seems to a limit
on how long a statement can be:

INSERT INTO CUSTOMER (forename, surname, company_name, title, addressA,
addressB, postal_number, city, country, home_phone, mobile_phone,
work_phone, fax, email, sale_procentage, bank, account_number,
creation_initials, creation_date, creation_reason) values ("test", "test",
"test", etc...);

But I can only enter this much text:

INSERT INTO CUSTOMER (forename, surname, company_name, title, addressA,
addressB, postal_number, city, country, home_phone, mobile_phone,
work_phone, fax, email, sale_procentage, bank, account_number,
creation_initials, creation_date, creation_reason) va

Is there some upper limit? And how do I make a long SQL statement like this?

JS"JS" <dsa.@.asdf.com> wrote in message news:d6ilga$rpj$1@.news.net.uni-c.dk...
>I am trying to make the following SQL statement, but there seems to a limit
> on how long a statement can be:
> INSERT INTO CUSTOMER (forename, surname, company_name, title, addressA,
> addressB, postal_number, city, country, home_phone, mobile_phone,
> work_phone, fax, email, sale_procentage, bank, account_number,
> creation_initials, creation_date, creation_reason) values ("test", "test",
> "test", etc...);
> But I can only enter this much text:
> INSERT INTO CUSTOMER (forename, surname, company_name, title, addressA,
> addressB, postal_number, city, country, home_phone, mobile_phone,
> work_phone, fax, email, sale_procentage, bank, account_number,
> creation_initials, creation_date, creation_reason) va
>
> Is there some upper limit? And how do I make a long SQL statement like
> this?
> JS

It sounds like you're using a window somewhere in Enterprise Manager? If so,
then just use Query Analyzer instead - it's a much better tool for
development and having precise control over what you're doing.

There is a maximum batch size for SQL commands, which depends on your
network packet size (see "Maximum Capacity Specifications" in Books Online),
but it's probably not a limit for most practical purposes.

Simon

No comments:

Post a Comment