Skip to main content

Posts

deleting data from a MSSQL table in chunks

Often I've found it more reliable to break up data destruction into chunks CTE ( Common Table Expressions) makes it easy  and quick to delete the top x number of records from a table ;WITH CTE AS ( SELECT TOP 10000000 * FROM [dbo].[TargetTable] ) DELETE FROM CTE  If you want to get rid of all data in the table, there is always TRUNCATE TABLE [dbo].[TargetTable]

Dumping MySQL tables schema's out to file

The mysqldump command line program does this for you - although the docs are very unclear about this. One thing to note is that ~/output/dir has to be writable by the user that owns mysqld. On Mac OS X: sudo chown -R _mysqld:_mysqld ~/output/dir mysqldump --user=dbuser --password --tab=~/output/dir dbname After running the above, you will have one tablename.sql file containing each table's schema create table statement) and tablename.txt file containing the data. If you want a dump with schema only, add the --no-data flag: mysqldump --user=dbuser --password --no-data --tab=~/output/dir dbname

stuff IIS share and permissions

Recently I had a problem where my IIS server returned a 500 error. This came after I changed permissions carelessly to enable network sharing on inetpub so I could publish files there. As a result of doing to network share, I lost IIS_IUSRS and IUSR's ability to access the inetpub folders. I wasn't to know that at the time, I restored access simply by putting IIS_IUSRS and IUSR back

Get QueryString value using javascript

var vars = [], hash; var q = document.URL.split('?')[1]; if(q != undefined){ q = q.split('&'); for(var i = 0; i < q.length; i++){ hash = q[i].split('='); vars.push(hash[1]); vars[hash[0]] = hash[1]; } } You can now access a querystring value simply by referecning the vars array like vars["someinput"] ;