|
If these tables become large, you're really going to have some performance issues stripping out these string values all the time - you really should consider denormalising these keys...
|
|
|
|
|
What does it mean to denormalise the keys? Like I said in my other response, I don't actually have any training on SQL, so I'm kinda figuring this out as I go. Thanks!
|
|
|
|
|
SELECT * FROM Task_Questionnaire WHERE (DAG_Flag='D') AND (TIR Like 'T***-***') ORDER BY RecNumber;
This works in access, however, once on my dot net page, and I call it, it doesnt. In all actually I am just trying to get were TIR = NULL, I've tried Is Not Null, and Not Null, and that doesnt seem to function either!
|
|
|
|
|
Answer is
<br />
strSQL="SELECT * FROM Task_Questionnaire WHERE (DAG_Flag='D') AND (TIR Like 'T%%%-%%%') ORDER BY RecNumber;<br />
Use of % for patterns!
|
|
|
|
|
SELECT * FROM Task_Questionnaire WHERE (DAG_Flag='D') AND (TIR is NULL) ORDER BY RecNumber;
Will this work ?
|
|
|
|
|
I am sorry I was tired last night and mistyped, I was actually trying to get it were it wouldnt pull any NULL values in.
|
|
|
|
|
Can you use an ODBC connection between MS Access and Sybase if LDAP is involved? LDAP beig the storage location for user authentication to a Sybase database.
My company and I are worried that our "existing" ODBC connections with Sybase will no longer work once usernames and passwords for Sybase databses are controlled through LDAP.
I can only hope that I explained myself adequately, let me know if you need further info.
thanks
|
|
|
|
|
Hi all,
Let me supply the Code and then explain:
DECLARE @vchRequestNumber Integer<br />
<br />
SELECT @vchRequestNumber = MAX(CONVERT(INT,(ISNULL(vchRequestNumber, 0))))+1<br />
FROM tblRequest
Ok, here's the deal..
What works:
IF vchRequestNumber is GREATER THAN 0 in the TABLE, the code WORKS.. and therefore I am presented with a value of vchRequestNumber PLUS 1.
What Doesn't work:
IF vchRequestNumber is NULL, then a ZERO replaces it(which is fine); BUT it is returning 0 instead of 0 PLUS 1.
Anyone has any ideas???
|
|
|
|
|
Hi Dayekh,
try this:
DECLARE @vchRequestNumber INT<br />
<br />
SELECT @vchRequestNumber = MAX(CONVERT(INT,(ISNULL(vchRequestNumber, 0))))<br />
FROM tblRequest<br />
<br />
SET @vchRequestNumber = @vchRequestNumber + 1
Greetings
Ralph
|
|
|
|
|
hehehe.. i tried that exact thing right now.. but it doesn't work...
I found the problem tho.. when no records exist, i.e. when vchRequestNumber is NULL, the ENTIRE evaluation is returning a NULL... so this is what I had to do:
ISNULL(MAX(CONVERT(INT,(ISNULL(vchRequestNumber, 0)))),0)+1
Thank you for the reply!
|
|
|
|
|
Alternatively, you could use COALESCE(vchRequestNumber, 0) + 1
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I currently have a SQL statement that basically looks like this.
SELECT [ID]
FROM
tblOne O
WHERE
(O.EventType = 'START'
AND O.Date <= @Today)
OR (O.EventType = 'END'
AND O.Date >= @Today) What I need to do is to pull records that have both a START and END that fit the criteria and if one is missing I need to exclude it. Is that possible through a SQL statement or will I need to continue looping through the records as this code already does?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Hi,
replace your "OR" with "AND"
Greetings
Ralph
|
|
|
|
|
Unfortunately, that won't work in the example because the columns are the same for both parts.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Which is why this sucks.
Im just trying to avoid getting the records back and then looking through them to determine what needs to be present on my side.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Well, assuming that there is something unique that links the start and end tasks together, you could use:
SELECT O.[ID], O1.[ID] As ID2
FROM
tblOne O
INNER JOIN tblOne O1
ON O.SomeUniqueKey = O1.SomeUniqueKey AND
O1.EventType = 'END' AND O1.Date >= @Today
WHERE
O.EventType = 'START AND O.Date <= @Today
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks!
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
hi i am just wondering if u can use a stored proc(to have a group of values returned) in a stored proc or an sql statement and if so how to go about doin it thanks in advance
Tim
|
|
|
|
|
In SQL Server, you would execute it inside your stored procedure using EXEC procname .
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
thanks alot
what about parameters if there are any can they just be placed in brackets
|
|
|
|
|
exec procname param1,param2,...
|
|
|
|
|
thanks again but one last q about this statement i want to execute the proc pr_cd_GetFirstTeamLeagues which accepts a clubid which is 7 here do u have any idea why it aint workin
Select s.ID
From Match m
Join Squad s on (m.SquadA = s.ID or m.SquadB = s.ID)
Where exec pr_cd_GetFirstTeamLeagues 7
And m.CompetitionID = 0 -- Premier League
And m.Date Between (Select StartDate From Seasons Where ID = 50) And (Select EndDate From Seasons Where ID = 50)
Group By s.ID
Order By dbo.pr_bll_GetSquadLeaguePointsForSeason(s.id, 50) Desc
|
|
|
|
|
If you are wanting to do something like this, then you must use a stored function rather than a stored procedure.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
that was actually my first thought but i wasnt sure how to return multiple values from a function can this be done???
|
|
|
|
|
It depends on what you mean by multiple values. Inherently, no it can't - a function returns one value. However, this value might be an in memory table so it is possible to return multiple items.
Deja View - the feeling that you've seen this post before.
|
|
|
|