Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: tosql datatypes


From   "Hendri Adriaens" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: tosql datatypes
Date   Wed, 13 Jun 2007 13:21:35 +0200

Hi Kit, 

> I am not sure what convenient syntax could be used to achieve this.  
> For instance,
> 
> webuse auto
> gen long priceyen=100*price
> 
> will create a long int, which is probably what you want large  
> integers to be represented as in SQL. But if you just use generate  
> without specifying datatype, it would make it a float. In this  
> dataset, you cannot just treat floats as longs, as -headroom- would  
> then be mangled. I suppose you could have as many options as there  
> are SQL datatypes, and allow something like
> 
> tosql, table(junk) cre int(...)  bigint(...) float(....)  double( ...)
> 
> providing for varlists with wildcards in each case. Would that make  
> sense? Variables not listed in any of the varlists would take on  
> their Stata datatypes.

Yes, this looks very good and would make tosql better equiped for sql. BTW,
another question: how come tosql is so slow? I am running it on a very fast
server, on a dataset of 22mb and it takes at least an hour (didn't time it
exactly) to write the 188mb sql file. Is it because of the slow for loop
implementation of stata? Or something else maybe?

Thanks for your answer, best regards,
-Hendri.


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index