Dominique Boucher
  • Member for 5 years, 4 months
  • Last seen more than a week ago
  • Saint-Hubert, Longueuil, QC, Canada
Calling a powershell script using xp_cmdshell with parameter in T-SQL
1 votes

If you look at the line that your print command return, it looks like this: powershell -command "C:\SQL_Powershell\General\MoveFile.ps1" ""C:\BPA Exports\Change Point 1\Processing\&...

View answer
What is the way to clear the tlog without taking the log backup?
Accepted answer
2 votes

Like mentionned by Bob Klimes, if you are not keeping the transaction log, it does not make that much sense to have the database set to full recovery model. I'm thinking maybe you do it because you ...

View answer
DBA - Checklist Question- TempDB Is Full
1 votes

There is so many use cases.. Here's what I would check first: 1- If you connect and tempdb is no longer full: Usually, this happen because some process ran out of space and SQL rolled back that ...

View answer
SQL case problem
Accepted answer
1 votes

SQL cannot return data that does not exist... if there is no monday in your data, SQL won't "guess" that you are expecting something for monday... (The case does not what you are expecting ...

View answer
How do you detect a change in grouping when using Partition By in SQL Server 2012+ and execute logic based upon the change in the same SQL statement?
Accepted answer
0 votes

Here's an example of an SQL Query that would achieve what you are expecting: create table #school (school_name varchar(20), school_area varchar(20)); insert into #school values ('someschool1', '...

View answer
Why is it not important whether data and log files share the same disk or not in a SAN?
3 votes

When on a SAN, you do not write to 1 specific disk but to a set of disks (managed at the SAN level). When you use physical disk, you want to split IO to prevent from IO bottleneck causing performance ...

View answer
How to 'pause' SQL Server AlwaysOn Availability Group
0 votes

The simpliest way seems to simply shut down both nodes. That way, no one will be able to connect to them. If ever you need to roll back to them, just turn one of them (or both) on and they will then ...

View answer
Updating column value across all SQL server versions
Accepted answer
0 votes

This "update" statement will update all rows with the provided values. If this is what you need, then I would simply ask why you have this column on every single rows of this table... You ...

View answer
Always On with multi AGs primary on each replica - Any gotcha's?
0 votes

You'll need to automate some kind of "load balancing" otherwise, if there is an issue with one one the node during the night, all AGs will run on the same server. Unless you want to fail ...

View answer
Reclaim disk after drop table in sql server
Accepted answer
5 votes

The database files (mdf and ndf) will not reduce in size if you remove data (or object like a table). The only way (Well you could also create a new DB and move the content from the old to the new and ...

View answer
Automation of MSSQL database transaction log file truncation
4 votes

Log files are as important as the data file as they are there to preserve data integrity. The only way to truncate (which will not reduce the size of the file on disk) is to take a log backup (...

View answer
SQL - Counting number of friends
1 votes

I'm sure there will be better script to achieve it but this may be a starting point (as it returns what you are expecting). create table #txt (sender varchar(40), receiver varchar(40)) insert into #...

View answer
How to get currently used SSL certificate thumbprint from MSSQL
Accepted answer
1 votes

You can check in the SQL Server log (openning it from powershell of with a sp_readerrorlog) If you go with the TSQL approch, a script like this should do the job declare @lastReboot datetime; select @...

View answer
SQL Query to Return Rows that don't exist as blank
0 votes

You could use a table that would contains numbers from 1 to 100 and then use a left join in your query to get all numbers (from this table) join to the data in your other tables. ex: create table #...

View answer
Disabled SA user is listed as logged in
0 votes

This is because some "system" session are showing "sa" as the username. I think you can add a where is_user_process = 1 in your query to exclude those system session and you ...

View answer
Restoring full back up taking forever
Accepted answer
4 votes

This is the expected behavior. When you restore using "With no recovery", it tell SQL to leave the DB in the "recovery" state (allowing you to restore subsequent backup). If you ...

View answer
select one row based on a string
0 votes

You can also use a reference table and use it to do a left join like so: create table demo (computer_id int, soft varchar(20)); insert into demo values (1,'Adobe'),(1,'Office'),(2,'Adobe'),(2,'7Zip'),(...

View answer
Append String To Int
Accepted answer
1 votes

Try with something like: Convert(Varchar(100),Cast(Round(Coalesce(totalsaleamt,0) * 100,0) As Int)) + '%' That will convert your INT into a varchar and it will then be possible to add the % sign.

View answer
Does listener gets affected when we replace secondary replica with another server in Availability Group?
0 votes

The listener is a cluster ressource. If you new server is part of the cluster and is added to your availability group, it should work just fine.

View answer
Optimizing syncing of large dataset between 2 servers with SSIS
Accepted answer
1 votes

You want to add a "lookup" operator in your SSIS pacakage. this package will "check" for some columns (your PK for example) and you will then be able to take action on only the ...

View answer
Does SQL Table Column is assigned with column number
1 votes

The row number you get in SSMS (I'm presuming you were refering to this number) is not generated by SQL but by SSMS (so it doesn't really exist in your database). SQL does have a "number" ...

View answer
High performance count with where clause and dynamic data
0 votes

You will need to look at the data repartition first. (Selectivity) Let's say you're looking for rows where the amount is especially high or low. If there are not that many rows that match, then an ...

View answer
How to use a select pivot query to update two different tables
1 votes

I'm not 100% sure to understand your question but if you are looking at doing and UPDATE from a SELECT, then you may want to look at this.

View answer
How can I bring a database offline safely?
0 votes

Dropping the active connection should not be what causes your database to get corrupted. When you bring a database online, SQL will replay the log (redo/undo phase) and in a context like the one you ...

View answer
Capturing SQL calls sent to a remote server from application
1 votes

Depending on your SQL version, you could run a Query Trace or an Extended Event to capture the TSQL being run by your app.

View answer
SQL Server - Benefits of splitting databases across different logical drives
0 votes

I think that the writes to the data file are not done "live". Usually, you'll have performance impact when the log files are on a "slower" storage (as SQL need to write the log ...

View answer
Recursive CTE with partition
Accepted answer
2 votes

This would produce the expected result: create table #demo (id int, race int, lap int) insert into #demo values (1,21,11),(2,21,null),(3,21,null),(4,21,null),(5,29,65),(6,29,null),(7,29,null),(8,29,...

View answer
"Test-SqlAvailabilityGroup" takes too much time
0 votes

I guess if you only want to see if the Availability group exists, you could query the DMV: select name from sys.availability_groups That will return all the name of the AG(s) on that specific ...

View answer
Free Drive Space and SQL Server Agent Alerts
Accepted answer
1 votes

This is an OS information. I don't think there will be an Alert in SQL that will track the remaining space on the drives. Pretty much all of the monitoring products monitor this and can send you ...

View answer
Cannot connect after Availability Group automatic failover
1 votes

If you cannot reach the listener from SSMS, then it seems to be an issue with networking or name resolution (DNS). You can try do to a NSLOOKUP of your listener and make sure it point at the primary ...

View answer
1
2 3 4 5