Showing posts with label blogsdid. Show all posts
Showing posts with label blogsdid. Show all posts

Wednesday, March 7, 2012

Don't Know How To Explain It

The tables are as follows
CREATE TABLE dbo.Blogs
dId int * PRIMARY
posted datetime(8)
title nvarchar(50)
catgy nvarchar(50)
blogs nvarchar(500)
picId int
UName nvarchar(50)
CREATE TABLE dbo.BlogPix
bgId int * PRIMARY
picId int
Photo nvarchar(50)
Caption(50)
UName nvarchar(50)
I dont know how to explain it but this is the way i have the application
working. The UName on every table in the system is the User name of the User
and it returns rows filtered by UName = @.Uname. However this works fin on my
application but it gets tricky when i try to filter by picId. Ok, the picId
is not a autonumber and any user can get the same number at some time
because i am using the random class to generate a number from the smallest
INT32 to the biggest so i have big scope.
its so hard to explain what i mean so i will give an example,
SELECT TOP (30) *
FROM Blogs INNER JOIN
BlogPix ON Blogs.picId = BlogPix.picId
WHERE UName = @.UName AND PicId = @.PicId
basically i want to retrieve data by using the keyfields dId or picId which
ever way i can so i can return results like the following;
bgId !!!!!!! picId !!!!!!! Photo !!!!!!! Caption !!!!!!! UName
--1--99995688--~/pix/plig.jpg--im a minger--Sean--
--2--99995688--~/pix/pliglet.jpg--im a minger--Sean--
--3--99995688--~/pix/pligkil.jpg--im a minger--Sean--
--4--99995688--~/pix/plipim.jpg--im a minger--Sean--
--5--99995688--~/pix/plim.jpg--im a minger--Sean--
dId !!!!!!! picId !!!!!!! Title !!!!!!!!!!!!!!!!!! Blogs
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Posted
!!!!!!!!!!! Catgy !!!!!!! UName
--1--99995688--Me On A Gud Day--Im going gud and life is great--21
Aug 2005--Music--Sean--
--2--2568777--Me On A Bad Day--Im going gud and life is great--21
Aug 2005--Music--Sean--
--3--12369875--Me On A Nasty Day--Im going gud and life is
great--21 Aug 2005--Music--Sean--
--4--56888999--Me On A Lovely Day--Im going gud and life is
great--21 Aug 2005--Music--Sean--
--5--5896633--Me On A Dark Day--Im going gud and life is great--21
Aug 2005--Music--Sean--
Hope this helps, i cant really explain what it is but i do knowI think you'll find your answers in the following article:
http://www.sommarskog.se/dyn-search.html
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
"Eamon Straughn" <blackmanvandam@.aol.com> wrote in message
news:uUu9KJCrFHA.2076@.TK2MSFTNGP14.phx.gbl...
> The tables are as follows
> CREATE TABLE dbo.Blogs
> dId int * PRIMARY
> posted datetime(8)
> title nvarchar(50)
> catgy nvarchar(50)
> blogs nvarchar(500)
> picId int
> UName nvarchar(50)
> CREATE TABLE dbo.BlogPix
> bgId int * PRIMARY
> picId int
> Photo nvarchar(50)
> Caption(50)
> UName nvarchar(50)
> I dont know how to explain it but this is the way i have the application
> working. The UName on every table in the system is the User name of the
User
> and it returns rows filtered by UName = @.Uname. However this works fin on
my
> application but it gets tricky when i try to filter by picId. Ok, the
picId
> is not a autonumber and any user can get the same number at some time
> because i am using the random class to generate a number from the smallest
> INT32 to the biggest so i have big scope.
> its so hard to explain what i mean so i will give an example,
> SELECT TOP (30) *
> FROM Blogs INNER JOIN
> BlogPix ON Blogs.picId = BlogPix.picId
> WHERE UName = @.UName AND PicId = @.PicId
> basically i want to retrieve data by using the keyfields dId or picId
which
> ever way i can so i can return results like the following;
> bgId !!!!!!! picId !!!!!!! Photo !!!!!!! Caption !!!!!!! UName
> --1--99995688--~/pix/plig.jpg--im a minger--Sean--
> --2--99995688--~/pix/pliglet.jpg--im a minger--Sean--
> --3--99995688--~/pix/pligkil.jpg--im a minger--Sean--
> --4--99995688--~/pix/plipim.jpg--im a minger--Sean--
> --5--99995688--~/pix/plim.jpg--im a minger--Sean--
> dId !!!!!!! picId !!!!!!! Title !!!!!!!!!!!!!!!!!! Blogs
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Posted
!!!!!!!!!!! Catgy !!!!!!! UName
> --1--99995688--Me On A Gud Day--Im going gud and life is
great--21
> Aug 2005--Music--Sean--
> --2--2568777--Me On A Bad Day--Im going gud and life is great--21
> Aug 2005--Music--Sean--
> --3--12369875--Me On A Nasty Day--Im going gud and life is
> great--21 Aug 2005--Music--Sean--
> --4--56888999--Me On A Lovely Day--Im going gud and life is
> great--21 Aug 2005--Music--Sean--
> --5--5896633--Me On A Dark Day--Im going gud and life is
great--21
> Aug 2005--Music--Sean--
> Hope this helps, i cant really explain what it is but i do know
>