Skip to main content

Posts

Showing posts from February, 2016

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"] ;

Tips when installilng MSSQL Reporting Services

This guide uses the Express Tools, and assumes you have Visual Studio Community Edition already installed First, you need to install MSSQL with Advanced Services, on the server https://www.microsoft.com/en-au/server-cloud/products/sql-server-editions/sql-server-express.aspx Install normally, but remember to use an sa password, it's much simpler to remote manage the test server that way You will then need to install the Reporting Services Add-in for Visual Studio  You can do this by selecting "Tools" and then "How to get SQL Server Data Tools - BI" Alternatively, you could simply google "SQL Server Data Tools for Visual Studio 2013" Another option is installing SQL Report Writer, a much simpler and stand alone report editor.  I found Report Builder version 3 by googling "Microsoft® SQL Server® 2014 Report Builder" You then need to enable remote connections, check the following: Check that you can connect from the se

Office 365 Exchange - Remove AutoMapping of Shared Mail

https://support.microsoft.com/en-au/kb/2646504 The trick here is that the automapping feature is enabled when full rights are given to the shared mailbox. In powershell, you need to remove the rights, then add it back without the automapping feature (enabled by default) Add-MailboxPermission -Identity <Mailbox ID1> -User <Mailbox ID2>-AccessRights FullAccess -AutoMapping:$false

Tip when trying to install server 2012 from Win PE

Instructions on how to create a Win PE boot USB drive.  Creating a Win PE boot disk requires the Windows Assessment and Deployment Kit (Windows ADK) Information on how to create the USB drive is available from  https://technet.microsoft.com/en-au/library/hh825109.aspx The following features from the ADK need to be installed: Deployment Tools : includes the  Deployment and Imaging Tools Environment . Windows Preinstallation Environment  : includes the files used to install Windows PE. Start the  Deployment and Imaging Tools Environment  as an  administrator . Create a working copy of the Windows PE files. Specify either x86, amd64, or arm: copype amd64 C:\WinPE_amd64 Install Windows PE to the USB flash drive, specifying the drive letter: MakeWinPEMedia /UFD C:\WinPE_amd64 F: The guide at the link above also includes trouble shooting tips. Storing Windows Images on the Windows PE Drive Typically you won't be abl