This function will only sign the first 8,000 bytes of data in the plaintext. The function chops off everything after the 8,000th byte of data, ignoring it. The example indicates that the function will accept and sign an nvarchar(max) data type value, but again anything after the 8,000th byte is discarded. Below is a more accurate example:
-- Create a table in which to store the data
CREATE TABLE [SignedData04]( Description nvarchar(4000), Data nvarchar(4000), DataSignature varbinary(8000) );
GO
-- Store data together with its signature
DECLARE @clear_text_data nvarchar(4000);
set @clear_text_data = N'Important numbers 2, 3, 5, 7, 11, 13, 17,
19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79,
83, 89, 97';
INSERT INTO [SignedData04]
VALUES( N'data encrypted by asymmetric key ''PrimeKey''',
@clear_text_data, SignByAsymKey( AsymKey_Id( 'PrimeKey' ),
@clear_text_data, N'pGFD4bb925DGvbd2439587y' ));
GO