Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Determining type

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-10-29 : 15:38:27
There are several posts on the undocumented

PWDENCRYPT('MYPASSWORD')

function. Some posts store the result in a nvarchar column, while others use varbinary. Either seem to work.

I'm wondering if there's an SQL function that will display the 'type' of an object like PWDENCRYPT, to show not only it's type, but length (which seems to be 92 bytes).

Sam

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-10-29 : 16:01:36
The documented functions will indicate what type of data they return. The undocumented functions, naturally, won't. Unless you buy

The Guru's Guide to Transact-SQL

by Ken Henderson you might have some trouble finding more information on the undocumented functions and procedures.

Two things to remember though:

A. They're undocumented for a REASON. You should NEVER rely on an undocumented function in a production system. The behavior of undocumented stuff can change from version to version (indeed, PWDENCRYPT did change with v7.0)

B. If you need to have output of a certain datatype or format, you can always use CONVERT or CAST. Don't mold your code around what a function gives you, make those functions give you what you need.

There is also a function in SQL Server 2000, SQL_VARIANT_PROPERTY, that can tell you more about the data or expression you're getting back from a function or table.

Edited by - robvolk on 10/29/2002 16:25:20
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2002-10-30 : 08:51:14
I took KH's book off the shelf, but it didn't explain the data type / length of PWDENCRYPT, so I did some more poking around.

In QA, the displayed result of SELECT PWDENCRYPT is BINARY, 92 bytes (had to count 'em). I declared the storage in SQL as VARBINARY (I probably should've used BINARY), 92 bytes. Now PWDENCRYPT AND PWDCOMPARE are working with no CAST.

Sam

Go to Top of Page
   

- Advertisement -