SQL statements

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
dallasx
Forum Contributor
Posts: 106
Joined: Thu Oct 20, 2005 4:55 pm
Location: California

SQL statements

Post by dallasx »

Does anyone have an insert statement that or know where to get one that i can run to populate a database of state names and state abbreviations?

Thank you!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I could compile one with all the states and the towns/cities in them from a database I have... the abreviations I don't have though.

EDIT | Not even sure I've got all the states.... It was a while since I started compiling the list and I never finished it but it was worldwide and I'm almost certain I finsihed the US and most of europe/asia.
User avatar
dallasx
Forum Contributor
Posts: 106
Joined: Thu Oct 20, 2005 4:55 pm
Location: California

Post by dallasx »

d11wtq wrote:I could compile one with all the states and the towns/cities in them from a database I have... the abreviations I don't have though.

EDIT | Not even sure I've got all the states.... It was a while since I started compiling the list and I never finished it but it was worldwide and I'm almost certain I finsihed the US and most of europe/asia.
That would be excellent if you could do that. :)

Also, I have read articles about varchar, in SQL Server, holding up to 8,000 characters. If that is true, then what does varchar (100) mean, a length of 100 or some of length?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

dallasx wrote:
d11wtq wrote:I could compile one with all the states and the towns/cities in them from a database I have... the abreviations I don't have though.

EDIT | Not even sure I've got all the states.... It was a while since I started compiling the list and I never finished it but it was worldwide and I'm almost certain I finsihed the US and most of europe/asia.
That would be excellent if you could do that. :)

Also, I have read articles about varchar, in SQL Server, holding up to 8,000 characters. If that is true, then what does varchar (100) mean, a length of 100 or some of length?
I'll dig out what I have from this list I have.... what do you need exactly? because I have info on the longitudes, latitudes, timezone and magnetic declinations for each of these places too (be warned.... there's *thousands* of places in this list) if you want them....
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Here ya go...

I've zipped up two versions together for you... one has lots of places and the geographical data, the other is USA only. Both of these archives are identical by the way... don't download both, I only posted both in case you can't extract bzip2 files :)

[ 1.4 MB ] world_places.zip
[ 998KB ] world_places.tar.bz2

The are over 34,000 records for the world one, and over 32,000 in the USA one 8O

Hope it helps :)
User avatar
dallasx
Forum Contributor
Posts: 106
Joined: Thu Oct 20, 2005 4:55 pm
Location: California

Post by dallasx »

d11wtq wrote:Here ya go...

I've zipped up two versions together for you... one has lots of places and the geographical data, the other is USA only. Both of these archives are identical by the way... don't download both, I only posted both in case you can't extract bzip2 files :)

[ 1.4 MB ] world_places.zip
[ 998KB ] world_places.tar.bz2

The are over 34,000 records for the world one, and over 32,000 in the USA one 8O

Hope it helps :)
Good god, that is a lot of you know what. Heheh

Thanks a lot, I really appreciate it.
User avatar
dallasx
Forum Contributor
Posts: 106
Joined: Thu Oct 20, 2005 4:55 pm
Location: California

Post by dallasx »

d11wtq wrote: Hope it helps :)
Quick question, why do you think that SQL Server 2000 will give me an error if I try to seperate the values with a comma?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

dallasx wrote:
d11wtq wrote: Hope it helps :)
Quick question, why do you think that SQL Server 2000 will give me an error if I try to seperate the values with a comma?
I've never used SQL server of any sort so I wouldn't know how you'd import that SQL dump. That's come from MySQL but apart from the database engine it specifies I would ahve thought the SQL should be pretty standard to import as it is. If not, I bet there are tools out there to fix the minor differences :)

Can't help you more than that I'm afraid.
User avatar
dallasx
Forum Contributor
Posts: 106
Joined: Thu Oct 20, 2005 4:55 pm
Location: California

Post by dallasx »

d11wtq wrote:
I've never used SQL server of any sort so I wouldn't know how you'd import that SQL dump. That's come from MySQL but apart from the database engine it specifies I would ahve thought the SQL should be pretty standard to import as it is. If not, I bet there are tools out there to fix the minor differences :)

Can't help you more than that I'm afraid.
Well, you would think so.... heh. I tried the statement with 2 values, separated by commas and it gave me that error. I am like you, I thought that SQL statements were standard.
Post Reply