Posted by ricardo.sobral.santos on 02/21/07 22:05
Yes that is something I was needing.
I need to convert an Hex type to Varchar and use that as a id. I would
like to use an integer but the cast would not work.
I think I might have the answer.
ALTER TRIGGER myTrigger_INSERT ON aspnet_Membership FOR INSERT AS
--this is an INSERT FROM SELECT
INSERT INTO WikedCompetitions.dbo.testTable
SELECT
CAST(userId AS VARCHAR(16)), --pay attention to the column sizes
because of the uniqueidentifier type
(SELECT UserName FROM aspnet_Users WHERE aspnet_Users.UserId =
inserted.UserId),
Email,
Password
FROM inserted
So this casts the userID(Hex) from aspnet_Users table to Users table
which has a field called UserID as a Varchar(16).
the only big problem is the ammount of space that this is going to use
because it is a varchar.
Tks for the help.
Ricardo
[Back to original message]
|