我有一個稱爲登錄用戶名和密碼都使用ENCRYPTBYPASSPHRASE
檢查是否在SQL數據庫中存在加密的用戶名
然而,當我插入一個新的登錄帳戶,我想請檢查是否新登錄的用戶名沒有按加密表」已經存在。
如何檢查數據庫中是否存在用戶名?
我試過像select * from login where username = encryptbypassphrase('username', 'passphrase')
這樣的東西,但是出現了負面情況。
我有一個稱爲登錄用戶名和密碼都使用ENCRYPTBYPASSPHRASE
檢查是否在SQL數據庫中存在加密的用戶名
然而,當我插入一個新的登錄帳戶,我想請檢查是否新登錄的用戶名沒有按加密表」已經存在。
如何檢查數據庫中是否存在用戶名?
我試過像select * from login where username = encryptbypassphrase('username', 'passphrase')
這樣的東西,但是出現了負面情況。
我希望像這些使用:
--- For INSERT
insert into login
(username, encryptedphrase)
values
('username', encryptbypassphrase('username', 'passphrase'))
--- Checking a specific username, passphrase combination:
select *
from login
where username = 'username'
and encryptedphrase =
encryptbypassphrase(username, 'passphrase')
--- Checking if a specific username already exists:
select exists
(select *
from login
where username = 'username'
) userexists
用戶名已加密。所以說「username ='username'」不起作用。 –
所以,你實際上只存儲'encryptbypassphrase('username','passphrase')'? –
我認爲你必須交換的用戶名和密碼:'從登錄選擇*其中username = encryptbypassphrase(「密碼」,「用戶名」)'見:http://technet.microsoft.com/en-us/library/ms190357.aspx –
你是對的,謝謝。但在這個示例/問題中,這並不重要,因爲我使用相同的加密來插入並檢查用戶是否存在。 –
在哪個字段中存儲加密黴素的結果? –