Re: SA account



That is, no semicolon after END TRY. (On the other hand, if you want
semicolons in every possible place, I think you should have one after
BEGIN TRY and also BEGIN CATCH.)

Thanks for the correct, Erland. I didn't intend to include the semicolon after the END TRY.

--
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message news:Xns9C0EBCB39548Yazorman@xxxxxxxxxxxx
Dan Guzman (guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I appreciate if you provide me with a query that verifies that SA account
has no blank password.

BEGIN TRAN;

BEGIN TRY
ALTER LOGIN sa
WITH PASSWORD = 'st0ongp@assw0rd'
OLD_PASSWORD = '';
PRINT 'sa password is blank';
END TRY;
BEGIN CATCH
IF ERROR_NUMBER() <> 15151
PRINT ERROR_MESSAGE();
END CATCH;

ROLLBACK;

Small correction:

BEGIN TRAN;

BEGIN TRY
ALTER LOGIN sa
WITH PASSWORD = 'st0ongp@assw0rd'
OLD_PASSWORD = '';
PRINT 'sa password is blank';
END TRY
BEGIN CATCH
IF ERROR_NUMBER() <> 15151
PRINT ERROR_MESSAGE();
END CATCH;

ROLLBACK;

That is, no semicolon after END TRY. (On the other hand, if you want
semicolons in every possible place, I think you should have one after
BEGIN TRY and also BEGIN CATCH.)




--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


.



Relevant Pages

  • Re: getdate() in UDF
    ... Or it is classified as imprecise rather than non-deterministic? ... return from Erland) ... > Here noofyears is a computed column which tells us how long a person ... > SQL Server must materialize the values. ...
    (microsoft.public.sqlserver.programming)
  • Re: stored procedure question
    ... Erland, ... regarding computing and large insert be done directly in the database. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Syntax coloring: SERVICE
    ... If so, Erland, it is only because I have failed in my attempts to ... any version of Outlook. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: a simple sql question
    ... I can confirm Erland. ... I wrote a course for 6.5 and distinctively remember that ANSI joins were new. ... They didn't re-write BOL for 6.5, they just added a "What's new in SQL Server 6.5" section. ... · CROSS JOIN ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL-Batch mit Transaktion ausführen/abbrechen
    ... Schau mal in Dein SQL Server /Install Verzeichnis. ... "Stefan Dase" wrote: ... >> SQL Server MVP Erland Sommarskog hat auf seiner Seite ... >> in T-SQL, die dich weiterbringen werden. ...
    (microsoft.public.de.sqlserver)

Quantcast