Wednesday, March 28, 2012
How to enrypt password in a table?
I use SQL 2K and have a table "tblPassword" which stores all the username
and passwords for front end login validation. I want to encrypt these table
so only "sa" can read. How can I accomplish this ?
Thanks
kaiHi
Not in SQL Server 2000. Get an application to do it and look at it though
the application.
Regards-
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"kai" <kailiang@.earthlink.net> wrote in message
news:J_PHe.1993$ns.1635@.newsread1.news.atl.earthlink.net...
> Hi,
> I use SQL 2K and have a table "tblPassword" which stores all the username
> and passwords for front end login validation. I want to encrypt these
> table so only "sa" can read. How can I accomplish this ?
> Thanks
> kai
>|||Hi,
Have a look into the below URL.
http://www.activecrypt.com/help/xpc...tep_by_step.htm
Thanks
Hari
SQL Server MVP
"kai" <kailiang@.earthlink.net> wrote in message
news:J_PHe.1993$ns.1635@.newsread1.news.atl.earthlink.net...
> Hi,
> I use SQL 2K and have a table "tblPassword" which stores all the username
> and passwords for front end login validation. I want to encrypt these
> table so only "sa" can read. How can I accomplish this ?
> Thanks
> kai
>|||Hi, Mike
Thanks.
Kai
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:OMAl6q5lFHA.2860@.TK2MSFTNGP15.phx.gbl...
> Hi
> Not in SQL Server 2000. Get an application to do it and look at it though
> the application.
> Regards-
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "kai" <kailiang@.earthlink.net> wrote in message
> news:J_PHe.1993$ns.1635@.newsread1.news.atl.earthlink.net...
>|||Hari,
Thanks for the link. Where I can find
master..xp_sha1
Thanks
Kai
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:u74DSv5lFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Have a look into the below URL.
> http://www.activecrypt.com/help/xpc...tep_by_step.htm
> Thanks
> Hari
> SQL Server MVP
> "kai" <kailiang@.earthlink.net> wrote in message
> news:J_PHe.1993$ns.1635@.newsread1.news.atl.earthlink.net...
>
Sunday, February 19, 2012
How to do a Join Using Foreign Keys in Stored in a Database Column?
keys. Would someone show me how to do a join using the values from a
list stored within a record?
For example, a record in tbl_cds.genre_id might have a value of "2,
5, 6" corresponding to genre_ids 2 , 5 and 6. I want to join
tbl_cds.genre_id to tbl_genre.genre_id using the values in that data
field.
It seems I need a loop like this:
SELECT * FROM tbl_cds
WHERE
Begin Loop
tbl_cds.genre_id[i] = tbl_genre.genre_id
End Loop.
Would someone give me the correct syntax?
Is there an alternative method that would create less overhead?
Sorry for such a novice post.On 17 Apr 2007 14:55:36 -0700, Chris wrote:
Quote:
Originally Posted by
>I have a database column that stores a comma delimited list of foreign
>keys. Would someone show me how to do a join using the values from a
>list stored within a record?
>
>For example, a record in tbl_cds.genre_id might have a value of "2,
>5, 6" corresponding to genre_ids 2 , 5 and 6. I want to join
>tbl_cds.genre_id to tbl_genre.genre_id using the values in that data
>field.
>
>It seems I need a loop like this:
>SELECT * FROM tbl_cds
>WHERE
>Begin Loop
>tbl_cds.genre_id[i] = tbl_genre.genre_id
>End Loop.
>
>Would someone give me the correct syntax?
>Is there an alternative method that would create less overhead?
>
>Sorry for such a novice post.
Hi Chris,
You can't. And that's because the database design volates one of the
basic principles of databases - you store a single value in a column.
If a CD can belong to three genres, you'll have to add a table like
this:
CREATE TABLE CDGenres
(CD_ID int NOT NULL,
Genre_ID int NOT NULL,
PRIMARY KEY (CD_ID, Genre_ID),
FOREIGN KEY (CD_ID) REFERENCES tbl_cds(CD_ID),
FOREIGN KEY (Genre_ID) REFERENCES Genres(Genre_ID)
);
If you don't have a master table of all genres, then you can leave out
the last foreign key constraint.
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis|||Chris (christopher.b.lewis@.gmail.com) writes:
Quote:
Originally Posted by
I have a database column that stores a comma delimited list of foreign
keys. Would someone show me how to do a join using the values from a
list stored within a record?
>
For example, a record in tbl_cds.genre_id might have a value of "2,
5, 6" corresponding to genre_ids 2 , 5 and 6. I want to join
tbl_cds.genre_id to tbl_genre.genre_id using the values in that data
field.
>
It seems I need a loop like this:
SELECT * FROM tbl_cds
WHERE
Begin Loop
tbl_cds.genre_id[i] = tbl_genre.genre_id
End Loop.
>
Would someone give me the correct syntax?
Is there an alternative method that would create less overhead?
As Hugo said, you are in desperate need of a redesign.
On SQL 2005 you can nevertheless do:
SELECT *
FROM tbl_cds c
OUTER APPLY list_to_table(c.genre_id) l
JOIN tbl_genre g ON l.num = g.genre_id
where list_to_table is a table-valued function that unpacks the
comma-separated list into a table. See
http://www.sommarskog.se/arrays-in-sql.html for examples of such functions.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx