Much better way to "Get name of current database"
Use SQL's own method to get the current DBName, no function needed.
2003-05-27
1,095 reads
Use SQL's own method to get the current DBName, no function needed.
2003-05-27
1,095 reads
We're pleased to announce that Robert will be writing for us each month - generally on stored procedures, but occasionally on a different topic. This article discusses how nesting stored procedures works and how to use @@NextLevel. Good reading! If there is a stored procedure topic you'd like to see covered, add a comment to the article or email us at articles@sqlservercentral.com
2007-10-02 (first published: 2003-05-23)
53,513 reads
If you have environment where you restrict access to database objects based on user roles and if you have a lot of databases on different servers in the same domain. The following script can generate roles from a given database in a format that can be used to create roles on different servers where the […]
2003-05-14
195 reads
Very frequently I used to use sp_help to find column names, datatypes and length of datatypes. Sp_help outputs a lot of data which i really don't require to see. so I devised this script
2003-04-30
100 reads
If you ever have been put in a situation where your database has a lot of objects and some of those do not have primary keys, trying to find feels like needle in the haystack. I have modified the script contributed by Mr.Tandrei and Mr.Rahul sharma. The following script gives all the tables that do […]
2003-04-17
146 reads
Copies the permissions from an existing database user to a new database user.Usage:exec copy_permissions_for_database 'From_User', 'To_User'* From_User must exist in the database.* To_User must not exist in the database.* To_User must exist as a login on the server.I used http://www.sqlservercentral.com/columnists/awarren/sqlpermissionspublicrole_2.asp as a starting point.
2003-04-14
1,887 reads
Here's a real-life challenge I was faced with at work: my company (a talent agency) needed me to create a report listing all of our actors that we represent - and for each actor, a comma-delimited string of each production that they've starred in. Simple enough, right......except that, within the comma-delimited list of productions, they […]
2003-04-11
795 reads
This is a follow-on to info's script to strip the time portion of a datetime or smalldatetime, leaving only the date. I found info's script interesting! When I had to do this I converted the date to varchar and back again instead of to float. Seems to work fine for me.
2003-04-03
123 reads
User Defined function to parse a string with known delimiters and return back the substing in the position.Takes string,delimiter and position as parameters. Can be used directly in TSQL code.
2003-03-27
336 reads
Brian Knight recently had the basic need to retrieve a record from the database at random. What seemed to be an easy task quickly became a complex one. This case showed an interesting quirk with T-SQL that was resolved in an equally quirky way. This quick article shows you a method to retrieve random data or randomize the display of data.
2003-03-26
9,384 reads
By Steve Jones
I’ve often done some analysis of my year in different ways. Last year I...
By Steve Jones
This was Redgate in 2010, spread across the globe. First the EU/US Here’s Asia...
By John
Today is Christmas and while I do not expect anybody to actual be reading...
I have a couple of SQL Agent job steps which run PowerShell commands of...
Comments posted to this topic are about the item Database security permissions save script
I have a SQL Agent job for backing up a set of Analysis Services...
I want to use the new BASE64_ENCODE() function in SQL Server 2025, but return a string that isn't large type. What is the longest varbinary string I can pass in and still get a varchar(8000) returned?
See possible answers