r/MSSQL • • Feb 28 '22

Best Practice How to Store Image Files in a SQL Server Database

Thumbnail
dcac.com
1 Upvotes

r/MSSQL • • Feb 19 '26

What is DBCC CHECKDB and how often should it be run?

1 Upvotes

What does DBCC CHECKDB do in SQL Server? Why is it important for DBAs? How often should it be run in production databases, and does it affect performance?


r/MSSQL • • Oct 26 '22

Performing a SQL Injection Attack...ON MYSELF!?

Thumbnail
youtu.be
0 Upvotes

r/MSSQL • • Mar 12 '16

Back Up Transaction Logs Every Minute. Yes, Really. - Brent Ozar Unlimited®

Thumbnail
brentozar.com
0 Upvotes

r/MSSQL • • Feb 02 '21

SQL Question How come I don't get any result?

0 Upvotes
SELECT DISTINCT TOP(1000) 
    pr.pid,
    CASE 
       WHEN [XMLProduct] IS NOT NULL 
            AND [XMLProduct].exist('/Standard/Prod[@Cat="HARDWARE" and text()[ contains(., "5th generation") or contains(., "6th generation")]]') =1
          THEN 1 
          ELSE 0  
    END,  
    CASE 
       WHEN [XMLProduct] IS NOT NULL 
            AND [XMLProduct].exist('/Standard /Prod[@Cat="HARDWARE" and text()[ contains(., "9th generation") and contains(., "Processor")]]') =1
          THEN 1 
          ELSE 0 
    END,
    CASE 
       WHEN EXISTS (SELECT 1 FROM product p
                    INNER JOIN category c ON p.id = c.id
                    WHERE p.ID = 15 AND c.cat = 12)
          THEN 1 
          ELSE 0 
    END
FROM 
    NewInventory AS ni
RIGHT JOIN 
    product pr ON ni.pid = pr.pid

I'm not getting any rows on this call when I am getting more rows when I don't use the RIGHT JOIN and SELECT ni.pid instead. This is not possible, because NewInventory is a subset of product and product contains all products.

I was wondering if there's an error I've made and if you could give me some tips on how to correctly use CASE WHEN when using a RIGHT JOIN.

Of course, If I do a LEFT JOIN, I get the same result, but I want to get all results, and not a subset. Is it somehow because the product table doesn't have the XMLProduct column? I can't make sense of why I am not getting the result I am expecting.


r/MSSQL • • Jul 09 '24

SQL Question How can SQL builder significantly help me with my business or project?

0 Upvotes

Can you share your personal user experience? how do you manage your project's automated Or which tools do you use to manage function properly.


r/MSSQL • • Mar 10 '23

Q & A Multiple SQL processes- not sure which I should start automatically

0 Upvotes

Which of the following do I need to keep active all of the time?

> SQL Server

> SQL Server Agent

> SQL Server Browser

> SQL Server CEIP servuce

> SQL server VSS Writer

SQL Server and SQL Server Agent seem self-evident but when do I actually need the rest?


r/MSSQL • • Jun 25 '15

Finding a User’s Server Roles via TSQL

Thumbnail
learntosql.com
0 Upvotes

r/MSSQL • • Feb 26 '20

Help with SQL WTF, Microsoft?

0 Upvotes
select convert(varchar(11), cast('2020-02-24' as date)) conv_date, 
   convert(varchar(11), cast('2020-02-24' as datetime)) conv_datetime 

conv_date	conv_datetime
2020-02-24	Feb 24 2020

Just spend a half an hour debugging a stored procedure trying to compare two dates by converting them both first.


r/MSSQL • • Dec 19 '24

SSRS Any SSRS experts here?

1 Upvotes

I need some help with a SSRS report I’m working on, can anyone help me? Thanks in advance.


r/MSSQL • • Feb 20 '21

Function LEAD (Transact-SQL) - SQL Server

Thumbnail
docs.microsoft.com
0 Upvotes

r/MSSQL • • Apr 11 '21

Function LAG (Transact-SQL) - SQL Server

Thumbnail
docs.microsoft.com
1 Upvotes

r/MSSQL • • Aug 05 '23

I don't believe in coincidences, SQL TCP 1433

Post image
0 Upvotes

r/MSSQL • • May 13 '22

Tool SQL Server Management Studio (SSMS) 18.11.1

Thumbnail aka.ms
2 Upvotes

r/MSSQL • • Apr 12 '26

What is one common mistake in Microsoft SQL Server that beginners make, and how can we avoid it?

6 Upvotes

r/MSSQL • • Mar 23 '24

Interview Question: What is the Role of a DBA in Managing an MSSQL Database?

Thumbnail
youtu.be
0 Upvotes

r/MSSQL • • Mar 24 '24

Interview Question: How do you Ensure the Security of an MSSQL Database?

Thumbnail
youtu.be
0 Upvotes

r/MSSQL • • Feb 15 '24

TSQL best cursor snippet

0 Upvotes

Check example. Its have not double "fetch" logic. But in Microsoft tutorials uses logic with double fetch. What is the best approach?

declare cur1 cursor for select .. from ..; declare @cur1_id int, @cur1_name varchar(250);

open cur1;
while 1=1 
begin
	fetch next from cur1 into
		@cur1_id, 
		@cur1_name;
	if @@fetch_status != 0 break;
	--row processing
	..
	print @cur1_name;
	..
end; --end processing cursor cur1
close cur1;
deallocate cur1;

r/MSSQL • • Feb 04 '25

Migration SQL Server 2019 Enterprise to 2022 Standard - Best Approach?

0 Upvotes

Hello everyone,

I need to perform maintenance on my SQL Server 2019 to switch from Enterprise to Standard, and I am also considering an upgrade to SQL Server 2022. When renewing my licenses, I realized that I am not using Enterprise features, so I decided to switch to Standard.

I read that downgrading requires a full reinstallation and database restoration. However, I have several questions about the best approach:

  • Should I first upgrade to SQL Server 2022 Enterprise and then switch to Standard?

  • Or would it be better to downgrade to SQL Server 2019 Standard before upgrading to SQL Server 2022?

  • Have you ever performed this type of migration? If so, what pitfalls should I avoid?

Thanks for your advice and feedback!


r/MSSQL • • Nov 15 '20

Q & A Office Hours: Ask Me Anything About Microsoft SQL Server. [Brent Ozar]

Thumbnail
youtube.com
4 Upvotes

r/MSSQL • • Aug 22 '22

Indexing SQL Server Performance Improvement using Database Engine Tuning Advisor and SQL profiler

Thumbnail
dotnetoffice.com
0 Upvotes

r/MSSQL • • Mar 07 '22

Tool Util for create tasks

0 Upvotes

Hi everyone!

I made a free utility for MS SQL Servers - "mssqltask-app"

The mssqltask-app utility is designed to run tasks centrally on multiple Microsoft SQL Servers at once. With its help, you can not only just run tasks, but also a).centrally collect data from many MS SQL servers and store them in one directory in JSON format; b). monitor the status of MS SQL servers in real-time using technical or business metrics;

See more - https://youtu.be/xXaeoi0Lqzc

Enjoy )


r/MSSQL • • Mar 10 '22

Best Practice Creating a stored procedure that kill blocking process?

0 Upvotes

I found one on the Internet, but I am not sure how good it is. I also would like to know how to give permission to a user to only run the stored procedure. Do I need to give that user write access only to the master db where you can run the stored procedure to kill blocking processes? Because in my understanding the processes are held in the master table.


r/MSSQL • • Jun 27 '16

Lessons learned from SQL Server process that took over 3000 hours to complete

Thumbnail
mssqltips.com
0 Upvotes