Read the registry using T-SQL
This script uses the extended stored procedure xp_instance_regread to read a value from the registry
2004-02-20
1,497 reads
This script uses the extended stored procedure xp_instance_regread to read a value from the registry
2004-02-20
1,497 reads
Indexes and table Statistics play a big role in an OLTP database for better query performance. Maintaining statistics on a weekly basis is important but a heavily updated database tables need more emphasis on Statistics and frequent updates. Instead of trying to issue “sp_updatestats” for the entire database, you can choose tables which are heavily […]
2004-02-17
2,002 reads
This stored procedure is created from the need to copy rows from a table with new value. The script itself will create stored procedure proc_copyrows.The parameters are@TableName: the table name@FilterField: filter field, default is null, means no filter@SourceValue: the value of filter field from source data to be copied@DestinationValue: the new value of filter field@SourceDB: […]
2004-02-13
273 reads
Generate an html-excel file with any table. Does not need Excel to generate , because does not use Excel automation
2004-02-12
439 reads
Search all text fields in a database for a literal string.Outputs SQL statements to query analyser window, which can then be run in a new window.
2004-02-10
210 reads
Stored procedure to search every field in the database for a string literal. Run the stored procedure in Query analyser, which will output sql statements to do the search. The output of these searches will be the update sql, which again should be pasted into a query analyser window. As the stored procedures do not […]
2004-02-10
267 reads
This script outputs the data in chronological order from the current SQL Server log.Output columns are: Log Entry Time, Event Source, Log Entry Text. This data matches with the data that can be seen under the SQL Server logs view in Enterprise Manager.The script is stand alone, but could easily be parameterised to work as […]
2004-02-10
891 reads
Generate an html-excel file with any table. Does not need Excel to generate , because does not use Excel automation.
2004-02-08
534 reads
sp_XTAB (prototype) produces pivoted (crosstab) views/output with a minimum of fuss.No messing with code, just tell XTAB what you want to pivot.Tested to 764 pivoted columns, XTAB can generate up to 63000 characters of dynamic sql. Example (deliberately over-simplified)----------------------updated 27 January 2004Use NorthwindEXEC sp_XTAB 'Northwind','xtEMPL_COUNTRY','Orders','EmployeeID','ShipCountry', '', 'OrderID','COUNT','NULL', '', 'SELECT xtEMPL_COUNTRY.* FROM xtEMPL_COUNTRY' -- Include optional […]
2004-01-24
399 reads
Function to allow for checking if an IP address is a private IP address. Will convert the IP to a bigint equivalent if within the private range, otherwise it will return null if IP is a public address.Requires function IPStringToNumber which is included in the post
2004-01-23
1,323 reads
By Arun Sirpal
Not every production incident is a database in RECOVERY_PENDING or a corrupted event (like...
It is Friday, the queries are running, and nobody is watching the bill. That...
By Steve Jones
Annabel retired from Redgate Software this week. Across most of my career at Redgate,...
Comments posted to this topic are about the item Extreme DAX: Take your Power...
Comments posted to this topic are about the item What is the Cloud?
Comments posted to this topic are about the item Changing the Schema
I set up a few users on my SQL Server 2022 instance.
CREATE LOGIN User1 WITH PASSWORD = 'Demo12#1' CREATE USER User1 FOR LOGIN User1 GO CREATE LOGIN User2 WITH PASSWORD = 'Demo12#2' CREATE USER User2 FOR LOGIN User2 GO CREATE LOGIN User3 WITH PASSWORD = 'Demo12#3' CREATE USER User3 FOR LOGIN User3 GOI then created a schema that one of them owned. Under this schema, I added a table with some data.
CREATE SCHEMA MySchema AUTHORIZATION User1
GO
CREATE TABLE Myschema.MyTable(myid INT)
GO
INSERT MySchema.MyTable
(
myid
)
VALUES
(1), (2), (3)
GO
SELECT * FROM MySchema.MyTable
GO
I granted rights and verified that User2 could access this table.
GRANT SELECT ON Myschema.MyTable TO User2 GO SETUSER 'USER2' GO SELECT * FROM MySchema.MyTable GOThis worked. Now, I move this schema to a new user.
ALTER AUTHORIZATION ON SCHEMA::Myschema TO User3; GOWhat happens with this code?
SETUSER 'USER2' GO SELECT * FROM MySchema.MyTable GOSee possible answers