Why use URL shorteners?

URL shorteners create web addresses that are easy to type and don’t get mangled by word-wrap. But they hide the real address. Here’s how to avoid nasty surprises.

Continue reading “Why use URL shorteners?”

Advertisements

Retrieve Users who have VIEW SERVER STATE Permission

Dynamic management views and functions return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance.

There are two types of dynamic management views and functions:

  • Server-scoped dynamic management views and functions. These require VIEW SERVER STATE permission on the server.
  • Database-scoped dynamic management views and functions. These require VIEW DATABASE STATE permission on the database.

To view users who currently have VIEW SERVER STATE, execute the following query:

SELECT 
who.name AS [Principal Name],
who.type_desc AS [Principal Type],
who.is_disabled AS [Principal Is Disabled],
what.state_desc AS [Permission State],
what.permission_name AS [Permission Name]
FROM 
sys.server_permissions what 
INNER JOIN sys.server_principals who
ON who.principal_id = what.grantee_principal_id
WHERE
what.permission_name = 'View server state'
AND who.name NOT LIKE '##MS%##'
AND who.type_desc <> 'SERVER_ROLE'
ORDER BY
who.name

viewState

To grant permission:

GRANT VIEW SERVER STATE TO [UserId]

Update Statistics in All databases on a server

Simply run this script in SQL Server Management Studio to obtain the script to run for the current server. Copy-paste the results in a new window and press F5.

DECLARE @SQL VARCHAR(1000) 
DECLARE @DB sysname

DECLARE curDB CURSOR FORWARD_ONLY STATIC FOR 
SELECT [name] 
FROM master..sysdatabases 
WHERE [name] NOT IN ('model', 'tempdb') 
ORDER BY [name] 

OPEN curDB 
FETCH NEXT FROM curDB INTO @DB 
WHILE @@FETCH_STATUS = 0 
BEGIN 
SELECT @SQL = 'USE [' + @DB +']' + CHAR(13) + 'EXEC sp_updatestats' + CHAR(13) 
PRINT @SQL 
FETCH NEXT FROM curDB INTO @DB 
END 

CLOSE curDB 
DEALLOCATE curDB

b-PAC Application Examples [ Print from Web Application]

This article explains the system configuration and coding examples to print Brother labels from the web. If you’ve ever tried to work with the Brother software SDK you definitely would have reached a point where you feel true frustration with the lack of documentation and samples from 2003 written in VBS and Visual Studio 2003 (that don’t even compile anymore).

Continue reading “b-PAC Application Examples [ Print from Web Application]”