SQL Batch alter all columns

< 1 min read

Sometimes you need to make mass changes to a database, and either add or remove a column, or other table or data manipulations. The script below prints SQL statements you can later execute for whatever you need. It loops through each table in your database, and replaces ? with the table name.

EXEC sp_msforeachtable
'PRINT ALTER TABLE ? ADD LastModified DATETIME NOT NULL DEFAULT GETDATE();
ALTER TABLE ? ADD UserID int NULL;
ALTER TABLE ? ADD Deleted bit NOT NULL DEFAULT 0;'
EXEC sp_msforeachtable
    'PRINT Update ? SET SiteID=1'

Filezilla Access to only certain subfolders

< 1 min read I had a scenario once, where I needed to give certain users access to multiple sub folders, without creating multiple FTP accounts. The goal was for them to see certain folders, but not others.
So let’s say my folder structure is:

And my user should be able to have full control of Site1 and Site2, but not even see Site3.
To do this, first create the user, and give him only List access on the root folder

Next, add each of the sub folders he has access to, and give him appropriate access on each sub folder.

When he connects now, he will only see the folders he has access to.