Hi,

the length funktion takes an expression as an argument, for example a 
column name like

select length(MyColumn) from MyTable;

Offhand, I can think of no way to calculate the sum of the lengths of 
the contents of all columns of a table without naming all the columns. 
There are two ways:

select length(MyColumn1 || MyColumn2 || MyColumn3) from MyTable;
or
select length(MyColumn1) + length (MyColumn2) + length (MyColumn3) from 
MyTable;

Also, you will probably want to watch for columns with null values. So 
this will work:

select coalesce(length(MyColumn1),0) + coalesce(length (MyColumn2),0) + 
coalesce(length (MyColumn3),0) from MyTable;

HTH
Martin


Am 01.06.2015 um 17:12 schrieb Drago, William @ CSG - NARDA-MITEQ:
> All,
>
> What is the correct syntax for getting the length of all columns in a table? 
> I tried
>
> SELECT Length(*) FROM myTable;
>
> and
>
> Length(SELECT * FROM myTable);
>
> Neither one of those works, and I can't find anything on line.
>
> Thanks,
> --
> Bill Drago
> Senior Engineer
> L3 Narda-MITEQ<http://www.nardamicrowave.com/>
> 435 Moreland Road
> Hauppauge, NY 11788
> 631-272-5947 / William.Drago at L-3COM.com<mailto:William.Drago at L-3COM.com>
>
>
> CONFIDENTIALITY, EXPORT CONTROL AND DISCLAIMER NOTE:This e-mail and any 
> attachments are solely for the use of the addressee and may contain 
> information that is privileged or confidential. Any disclosure, use or 
> distribution of the information contained herein is prohibited. In the event 
> this e-mail contains technical data within the definition of the 
> International Traffic in Arms Regulations or Export Administration 
> Regulations, it is subject to the export control laws of the U.S.Government. 
> The recipient should check this e-mail and any attachments for the presence 
> of viruses as L-3 does not accept any liability associated with the 
> transmission of this e-mail. If you have received this communication in 
> error, please notify the sender by reply e-mail and immediately delete this 
> message and any attachments.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to