Easiest way to verify that SQL has access to a folder that would contain mdf and ldf files
Re: Easiest way to verify that SQL has access to a folder that would contain mdf and ldf files I am writing a script to move ldf and/or mdf files. Doing the basic ALTER DATABASE commands below, but writing them in dynamic SQL so that multiple database…
How to determine which row in a table a LOB Page is connected to?
I have a table with Lob Data Pages, using DBCC IND and DBCC PAGE to look at a page, I am curious if there is a way to determine which record in the table the data on that page is tied too?
The conversion of a nvarchar data type to a datetime
When I get a report via view, I get an error like this. how can i fix this
Could drop user sa?
Dear Sir/Madam As we know user sa is default user that have sid=0x01 is_disabled=0 principal_id=1 on sys.server_principals table. Could we drop it to protect from attacker? Srean Regard Thank
Database consistency check for 2 TB database taking 14 hours 20 mins
1)Database size is 2 TB 2)Largest Tables (only one large table) Total pages it has - 274190987 3)Execution for this single DB consistency check is 13 hours 38 minutes 23 seconds. ---most of the time we had to cancel the execution just to avoid conflicts…
sys.dm_exec_cached_plans not showing any data after executing stored proc multiple times.
Executed different stored proc multiple times and ran below query to check stats. its not showing any data. SQL Version : Microsoft SQL Server 2012 (SP4) (KB4018073) - 11.0.7001.0 (X64) Stored Proc : exec [dbo].[uspGetManagerEmployees]…
Why Dynamic Sql written in procedure working and returning data on development server but not returning on production server
Why Dynamic Sql written in procedure working and returning data on development server but not returning on production server
Cannot connect to SQL Management studio 19.3
Hi Microsoft team, I have been trying to connect to the SQL server for a long time now and i have been getting error message cannot connect to.... How can i overcome this challenge?
Subquery makes complet code very slow
Hello, I have the following query that uses another query. As I understand the runtime behavior, this second query is called again every time the main query creates a new record. Both queries are actually quite fast. Unfortunately, the overall construct…
SQL Server unit test Item - Unable to locate version 17.10
Hi, I have installed Visual Code v 17.10 to start Unit testing but I'm unable to locate new item called Unit Test, Any thoughts where to locate or install to see SQL Server Unit Test item?
Best Practice/Standard Alias Schema/Table Convention
Just looking for suggestions for best practices and/or standards for table aliases in a Query. I know this is very subjective...but just looking for some general guidelines from experts and their experience and what works and what might not work. Should…
select query where condition with in operator and string with %
Hi, Below query is not working with in operator and string having % sign. DECLARE @types Table ( ID int, type varchar(50) mailtype varchar(50) ) INSERT INTO @types (ID, type, mailtype) SELECT 1, 'Redem', 'ABS_HOME' UNION SELECT 2,…
Grouping Data
Hello there, I need a help about the SQL Query. Data example: Date Amount 2024-01-11 10:15 1000 2024-01-11 11:10 2000 2024-01-12 10:16 5000 2024-01-13 11:12 4000 2024-01-13 11:18 4000 Expeceted result: Date Amount…
Azure SQL Database Stored Procedure long execution time issue
In my Azure SQL Database I have Stored Procedure sp_subledger (Attached the code : sp_subledger.txt) The Stored Procedure is completing within 1 min when Tenant = 1 is provided but when Tenant = 2 is provided it is running for more than 2 hours. for…
language of sql server 2022 and SSMS
Hello, I installed sql server 2022 and ssms in English on my machine. how to change the language to French of my sql server 2022 and my ssms. Best Regards
Where to graph precise tsql for a query run from php
I'd like to pin a plan for a query by adding a table hint. I've read the docs that says the query text pasted into @stmt must be the same as came from the app. I used the Extended Events 'sql_statement_completed' and 'rpc_completed' to get precise sql…
sql select query
Hi, We get data from vendor and import into table like this TxID BCode Ecode SType SCode Desc 12345 SR SR MF Abc This is one type 12346 SD SD MF Bcd One more type 12347 CC SD OF Efg New type 12348 SR SR MF Xyz I get…
The underlying provider failed on Open. while connecting to SQL Azure database through mvc application login
I've deployed my MVC application successfully on Azure..But while logging into application I get "The underlying provider failed on Open." I've implemented transient failure in code also. I connected my application locally to Azure SQL DB, its…
How to calculate number of weeks worked by an employee for a fiscal year in sql server
How to determine the total weeks an employee has worked during a fiscal year using SQL Server. My start date is 12-28-2023 and till today, I would like to calculate the no.of weeks worked by an employee during that time.
How can I close this Configuration review point 'Sanitize Database and Application User Input '
How we can close this configuration review point on Sanitize Database and Application User Input can you please guide me to close