Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Tuesday, January 20, 2009

Converting Tabs to Spaces

Here's a quick way to convert a tab-stopped file to a space-formatted file.

:set expandtab
:retab!

Wednesday, July 30, 2008

Quickly Populate a Table

There are a lot of times in MySQL when I want to populate a table with dummy data. I've used scripts to do this on many occasions; however, this stored procedure works just as well. I'm posting it here mainly for my own reference. Obviously the insert and while sentinel need to be modified for your particular uses.


delimiter //
create procedure populate_table()
begin declare i int default 0;
while i < 10000
do
insert into test values (i, 'test', 'test2');
set i = i+1;
end while;
end//
delimiter ;