|
Personally, unless there is a very good reason not to, I would pass the name and id. You need the id to look up the images, but database access is relatively expensive so I would avoid the round trip just to get the name.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield wrote: I would avoid the round trip just to get the name.
I'm already avoiding the round trip by using a denormalised view, where each product record includes the product name view.
|
|
|
|
|
Well there you go, you are doing it the way I would.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
How many of these lookups do you have? It seems likely your data layer would be caching them anyway...
|
|
|
|
|
I have file in macro word name : Dataku.
is anybody could tell me, how to execute that file from sql 2005.
Thanks before.
irvinia
|
|
|
|
|
irvinia wrote: I have file in macro word name : Dataku.
is anybody could tell me, how to execute that file from sql 2005.
Are you saying you want to run a macro in MS Word from within your database? I don't think that is possible...
|
|
|
|
|
Yes, i want to run macro in MS Word from database, and maybe that's not possible. ok, i will try looking for other way.
thank u for your replay, ChandraRam
|
|
|
|
|
If you're trying to use the article you mentioned before(www.codeproject.com/KB/miscctrl/data_dictionary.aspx[^]), the idea is that you place the macro in a new Word document (using macro editor), modify it and run it.
If it is something else you're after, please describe with more details.
The need to optimize rises from a bad design
|
|
|
|
|
Thank you for your replay.
i just try to change that code from that site to sql statement (maybe it's not simple), because i'm looking for the same method but with different language.
anyway, thanks again, Mike. i will looking for other way...
|
|
|
|
|
hi all,
i simply write a small code of piece which create backup of Sql server database. It works well but whenever i set the target path of back file to Desktop( or program files folder) then it gives following error
"Can not open backup device" & Target Path & ". Operating system error 5(Access is denied) /or Operating system error 3(Error not found).
Any body can help me to resolve this error ?
|
|
|
|
|
Hi Rupesh,
The backup crated by the sql server can be stored only on the machine where the SQL server is installed. Just create a folder in SQLServer and give full permission to this folder and then try to create the backup. I hope it will work.
Thx
|
|
|
|
|
hi all,
In my application i hav a search page.
I have a table with 5 Columns..
Columns are:
p_id,p_code,p_bedNumber,p_bathNumber,p_price
Table:
p_id p_code p_bedNumber p_bathNumber p_price
1 a1 2 3 100000
2 a2 3 4 210000
3 a3 2 1 12000
the search parameter may containe multi valuese for @p_bedNumber
ie. @p_bedNumber='3,4'
i want to display all records which has 3 or 4 in p_bedNumber column.
In this case only return 1 record..
I 'm looking to write a procedure plz help
|
|
|
|
|
Ha_80 wrote: the search parameter may containe multi valuese for @p_bedNumber
ie. @p_bedNumber='3,4'
i want to display all records which has 3 or 4 in p_bedNumber column.
try following where clause in query
where @p_bedNumber in ('3','4')
hope this helps
|
|
|
|
|
select * fro mytable where (p_bedNumber = 3) or (p_bedNumber = 4)
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
SELECT
column1,
column2,
if (column3 = 0)
begin
'Z',
end
else
begin
'C',
end
FROM table1
Is it possible that i can do it this way?
KaKaShi HaTaKe
|
|
|
|
|
Now, a question for YOU. Which takes longer, typing it in to CP and waiting for a reply, or typing in into query analyser and running it?
A clue, try the CASE statement.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield wrote: A clue, try the CASE statement.
A fine clue, that is
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
explain your self!!!!
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
SELECT
column1,
column2,
CASE
WHEN (column3 = 0)
THEN 'Z'
ELSE 'C'
END
FROM table1
-------------
Mostafa Noor
Egypt
|
|
|
|
|
Hi there,
I think you might want to use a CASE statement. Not sure which database system you are using but it would look something like this...
SELECT
column1,
column2,
CASE column3 WHEN 0 THEN 'Z' ELSE 'C' END
FROM table1
Cheers,
Kevin
|
|
|
|
|
Hi all,
i am still new in sql. i have problem now, how to generate database (
· Table Column Details
· Indexes
· Views
· Stored Procedures
· Functions
· Triggers
· Primary Keys
· Foreign Keys
· Default Constraints
· Identity Columns
, etc) to word.
once, i have the code from this site (and that's really good), but using macro in word. i have problem for convert to sql. www.codeproject.com/KB/miscctrl/data_dictionary.aspx
please help me, anybody...
thank before..
irvin
|
|
|
|
|
In order to help you, you should specify, what is the problem you're experiencing. If it's an error message, post the actual message you get.
The need to optimize rises from a bad design
|
|
|
|
|
better start building that!!!
ask later when stuck, nobody will post you the entire code you know?!
Helpers will direct you to some article or debug some of your code.
Good luck
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
ok, thank you....
|
|
|
|
|
Hi, I'm working on a site similar to newegg.com and I'm kinda stuck on the filters.
I know the best way would be javascript, however i don't know any library that can accomplish filters like those. So i was doing it in the old way (php > mysql query)
The problem is the optimization, i can't find a good method to do this. i designed the tables this way..
table item {item_id,category_id}
1,1
2,1
3,2
4,1
table filter {item_id,filter_id}
1,100
1,101
1,102
2,99
2,100
3,0
4,5
4,102
Let's say i want to show all items from cateogry 1, so i need to create the filters to be shown. the filters should be something like this
Filter | quantity of items
100 (2)
101 (1)
102 (2)
99 (1)
5 (1)
this is my query
select count(filter_id), filter_id
from filter
where item_id in (select item_id from item where category_id = 1)
and filter_id not in () -- this isn't used in first instance, only when an user click on a filter.
group by filter_id
That's the easy part, now if an user select a filter i need to show the items filtered. This is what i use.
select *
from item
where item_id in (
-- this is only for removing the null results
select item_id
from (
select
-- this shows only those items that have all the filter_id selected by the user
case when count(*) = ".count(explode(',',validateFilters($_GET['filters'])))." then item_id end
from filter
where filter_id in ( ".validateFilters($_GET['filters'])." )
group by item_id
) as p
where item_id is not null
)
and category = 1
and then i have to use that query inside the filter query to get the new filters
select count(filter_id), filter_id
from filter
where item_id in ( all the query above)
and filter_id not in ( ".validateFilters($_GET['filters'])." )
group by filter_id
is there an easier way?
Thank You.
modified on Sunday, October 5, 2008 2:57 PM
|
|
|
|