| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9
Comments:
<0> actually just one <1> matt`: so p*** the value in as a parameter, or a where statement ... <0> but I should beable to access the db through vba and create a new query, then delete it afterwards <0> curretly is as a where statement ie "..... Where mnf_id=" & agrs.mnf_id & "))....." in the vba <0> so a parameter huh? <1> MattyT: so don't put the where in the saved query <0> right. <0> how does that help? <1> then do ... "select * from savedquery where mnf_id= " & agrs.mnf_id & ")" <0> ahhhh <0> cant do that, as the saved query == cross tba <0> tab <2> ooo pinching... kinky
<2> :) <1> MattyT: sure you can ... just think about it ... <0> so the where statement is in a subquery fo the crosstab <1> just because it's a cross tab, doesn't mean you can't p*** it a parameter <0> hmmmmmm. <1> MattyT: so p*** it a parameter ... not a where condition ... <1> read up on it ... <1> I'm almost positive it's possible <1> might require access 2000 or 2003 ... but you should at least be working with 2000 by this point ... <3> can I specifiy "where" by if in mssql? <0> 2k3 <3> yes <3> 2k3 <0> monkeyisl: sorry - I was talking to MoZ <1> monkeyisl: there is no mssql 2k3 ... <3> ah <3> sry <1> MattyT: 2003 does all sorts of neat stuff, I've not delved into any of it ... read up on parameters or something ... <1> google ... <1> monkeyisl: your question makes no sense <3> MoZ : doesn't it? <3> MoZ : where some variable is set select * from lol where idx = 1, when it isn't select * from lol. <3> that's what i wanna do. <2> monkeyisl: huh? <2> i think you mean an IF <2> not a where <0> MoZ: when using parameters in the sql do you use :"PARAMETERS some_val value........Where someid=[some_val]..."? <3> siclude : yes IF <3> sicLuDe : any suggestion? <4> monkeyisl yeah write an if statement <3> i can not use @sql as string. <3> CoJoNEsXx : for example? <2> monkeyisl: look up on google <4> I ***ume you are writing a stored procedure? in mssql? <3> yes <3> i can <3> so you mean <2> or you can use WHEN <2> sorry case <2> CASE <3> select * from table1 IF @v == 1 where idx = 1 ? <3> ah <3> case <3> http://www.databasejournal.com/features/mssql/article.php/1438901 ? <3> liek that? <2> but there are if conditions also <3> i don't hitnk that's what i'm looking for <4> I still dont understand what you are trying to do <0> MoZ: right - now have the parameter working in my saved query - (just need to add an iff statement so that it works if no params are given) <3> so select * from table1 IF @v == 1 where idx = 1 ? <-- looks right? <2> CoJoNEsXx: he wants to run conditional queries based on varabile values <3> yes <4> so write a stored procedure <3> thanks SicLude <0> how do I supply the params in my code? <2> monkeyisl: look at the article you just posted... <2> it uses when not if <3> ok <3> let me try <2> you can use an if statement if your queries are very diff.. or use when if your queies are very similar <2> you can do either one in stored proc or out of stored proc
<3> hm. <3> i don't think case works for me <3> but maybe i'm wrong <2> so use an if <2> the only thing is that case will be inside a single query <3> like what <2> with an IF you will need 2 queries <2> dude look up how to use if with mssql on google <3> two queries <3> yes <3> i know i can use some nubmer of queries to do this <3> i know how to use if sir <4> this isnt hard <5> looking for drive/raid layout recommendations for ms sql 2000 <4> its very basic tsql <4> @ learnsql <6> learnsql = http://sqlzoo.net/ http://sqlcourse.com http://sqlcourse2.com ,this is my way of telling you that you make no sense <5> specifically, what sort of raid set should the tempdb & log files be placed on <3> if @val = 1 select * from table1 where idx = 1 else select * from table1 <--- this is what you're suggesting? <2> monkeyisl: if you did then you would not be asking <2> monkeyisl: heres an idea.. try the code <2> see if its giving you what you need <3> ok, is that what you said? <2> geez dude <3> .. <2> go try it out <3> i don't need to <3> cuz i know it works. <2> if you know how to use an IF... then use it <2> then why are you asking? <3> but there are like 5 params in my sp.. <2> ok and? <3> using if would **** in this case, wouldn't it? <2> it would depend on ur situation <2> why are you asking useless questions? <3> it's not useless <2> if you know how to do it wiht one variable... then why was your initial question about hwo to do it with one variable? <3> i wanna know if there is any good solution. <2> there many solutions <2> it depends on ur situation <3> SicLuDe : cuz it's a lot of dirty pieces of code. <2> you can create a lookup table <2> u can use case statements <2> you can use dynamic sql <2> you can not use stored procs altogether <3> can't use dynamic sql <2> yes you can <3> no <4> why cant you? <2> someone please kick this idiot <4> you know for not knowing anything you sure complain alot <0> MoZ: any ideas on the vba vs parameters plan? <7> nullify your input params, and do something like: SELECT * FROM table WHERE (@var1 IS NULL or idx = @var1) AND (@var2 IS NULL or date = @var2) <2> hes really getting on my nerves <2> dfworking: i think you are just confusing him now <7> if i understand what you're asking <7> ok, i didn't read it all <2> dfworking: no what you are saying works... i just dont think he will get it <3> dfworking : cool <3> thank you <2> what? he doesnt get how to use dynamic sql in here but he gets this? <7> heh <3> SicLuDe : i said no, i can not use. you can ***ign values to variables that are decleared sp in dynamic query? <0> MoZ: no worries I found the msdn article <3> select @hihi = count(idx) from t1 <-- can be dynamic query? <2> monkeyisl: yes you can ***ign variables in dynamic query: see sp_executesql <2> not that you would need to <2> but then again given taht you have nto defined what hte hell your variables are and how they would affect the conditions.. <3> i'm sorry <3> i'm korean. <3> i speak a little English. <0> anyone know how to set a recordsource to a recordset, (ie not a query name or sql) in access 2003 <3> i did my best.
Return to
#sql or Go to some related
logs:
#beginner funkmob #atheism Flash4 md5 icy torer #nhl #beginner #sex #computers steep parallax mapping #winvista
|
|