Results 1 to 8 of 8

Thread: Strange!

  1. #1
    Join Date
    Feb 2004
    Location
    PAKISTAN
    Posts
    106

    Exclamation Unanswered: Strange!

    CREATE TABLE #users(users varchar(50),pasw varchar(50),title varchar(50))
    insert into #users select 'test','abcdef','ceo'
    SELECT * FROM #users
    alter table #users alter column pasw nvarchar(50)
    update #users set pasw=pwdencrypt(pasw)
    SELECT * FROM #users

    What happens to the TITLE column?
    I had a table like the above with users and passwords in the Production DB. The password column had VARCHAR type. I changed it to NVARCHAR and encrypted the passwords. When i executed the SELECT *, the title column appeared like this.
    If i query the table by column names instead of * i see the correct values. I couldn't understand what behaviour is it.

    Howdy!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Nothing happened to the title column in my table. What happened in yours?

    -PatP

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I only get strange behavior when outputing to grid. Text output is fine. Perhaps one of the characters resulting from pwdencrypt(pasw) tabs to the next column.

    The ALTER statement is superfluous, as the effect occurs as long as the pasw column is nvarchar:

    select cast(pwdencrypt('abcdef') as nvarchar(50)),'ceo'

    ...demonstrates the issue.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    In mine the title changed from 'ceo' to a string of 22 non-printable characters (unicode it seems) and pwd is empty. Doesn't matter if I specify column names.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The encrypted value of the password probably includes a NUL (0x00h) character, which is what separates items in a grid. That would cause the grid's internal "cursor" to move to the next cell to the right.

    -PatP

  6. #6
    Join Date
    Feb 2004
    Location
    PAKISTAN
    Posts
    106
    Hi all; my situation resembles with grahamt's. I see the following value against the title column:
    ᯦⬓ᅤ훆៟ݕ䲺Ꙧ垦䣰⛵ꩽ䏪ᑿ鿕仗㮽쉃뺱鱦쾑聬

    However if i specify column names; the result is fine.


    Howdy!
    Last edited by TALAT; 05-04-04 at 14:54.

  7. #7
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    If the title is considered as Unicode data there don't appear to be any nulls but looking at as individual bytes the last four bytes are 0x0D, 0x00, 0x0A, 0x00 wich translate to CR, Null, LF, Null as Pat suspected.

  8. #8
    Join Date
    Oct 2014
    Posts
    1
    Quote Originally Posted by TALAT View Post
    CREATE TABLE #users(users varchar(50),pasw varchar(50),title varchar(50))
    insert into #users select 'test','abcdef','ceo'
    SELECT * FROM #users
    alter table #users alter column pasw nvarchar(50)
    update #users set pasw=pwdencrypt(pasw)
    SELECT * FROM #users

    What happens to the TITLE column?
    I had a table like the above with users and passwords in the Production DB. The password column had VARCHAR type. I changed it to NVARCHAR and encrypted the passwords. When i executed the SELECT *, the title column appeared like this.
    If i query the table by column names instead of * i see the correct values. I couldn't understand what behaviour is it.

    Howdy!
    You try
    Code:
    SELECT name, conver(varbinary, pasw) FROM #users

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •