Browse the archive

Databases

Transaction Replication on AlwaysOn

Question In our AlwayOn environment I have two SQL servers 2014 Ent.edition (SERVER A, and SERVER B). I setup a transaction replication for [database A ], pointing to listener which shouldn't cause any issue if a failover happened. Tested, worked just fine …

Continue reading

Releasing free space in mdf file to OS

Question We have a 120GB database. There was table with 60GB of data which is useless and we have truncated it. Now database size is 120GB with free space 60GB. The database will not grow up to 60GB in at least 3 months. So can we shrink the data file.

Continue reading

Transaction log growth during BACKUP

Over on Stack Exchange, someone asked why their transaction log was growing very fast during a full backup. An interesting tidbit to this question is that the database is in SIMPLE recovery – so the log should stay tiny, right? Wrong. While taking a full …

Continue reading

SQL Triggers not preventing insert

Question I am having trouble getting a trigger to work. What it needs to do is to prevent any customer with last name Glass from being inserted into the database. This is what I have: CREATE TRIGGER no_last_name_glass_trg ON customer AFTER INSERT,UPDATE AS …

Continue reading

Converting date stored as a varchar

Question I'm creating a query that has a column of dates stored as a VARCHAR in the format DD-MMM-YYYY. Could you tell me how I can convert this into date format please? I don't want to alter the original table in any way, as it's not mine to tinker!

Continue reading