Showing posts with label contain. Show all posts
Showing posts with label contain. Show all posts

Friday, March 23, 2012

Multiple Foreign Keys

I am constructing a db in sql server 2000 that will score cross-country running meets. I have an individual results table that needs to only contain participants that are entered as participants but are specific to a certain race as well. Can I have this table be linked back to TWO other tables via the PK-FK relationship and what issues might I have doing that?

Thanks!yes, you can, and no, there won't be any|||Hai rudy,

If i link a column in one table (say table A) with columns in two different tables(say B and C) using foreign key relation ship, does the columns in both those tables(B and C) should be of the same datatype..?

Thnks in advance|||for the sake of efficiency, i think they should be, however, i have no idea if you can actually link the same column in one table to two different other tables

why don't you try it and see if it works? let us know, thanks|||Thnks rudy, i will try it and let u know what happened...|||I think this is the setup you want. [RaceParticipant] is linked back to [Participant] by a ParticipantID, and to [Race] by a RaceID. ParticipantID and RaceID do not need to be the same datatype, but ParticipantID should be the same datatype in both the [Participant] and [RaceParticipant] tables, and [RaceID] should be the same datatype in both the [Participant] and [RaceParticipant] tables.

...[Participant]\
................[RaceParticipant]
.........[Race]/sql

Friday, March 9, 2012

Multiple Contain Statements

I need some help with this syntax
Select * FROM PROJECTS
WHERE CONTAINS(Problem_Description, '"Invalid use of null"') And WHERE
CONTAINS(Problem_Status, '"Open"')
Can you have multiple CONTAINS Statements?
I am getting a syntax error with the above code snippet. What am I missing?
Thanks!You have an extra WHERE clause. CONTAINS is a predicate, and you can
logically combine predicates using AND or OR; you only need one WHERE
clause:
WHERE CONTAINS(x, 'abc') AND CONTAINS(y, 'def')
But in your case, I'm wondering if you really want to use full-text search
for your problem status column? Will the status really be more than one
word? You'd probably have much better luck using:
WHERE CONTAINS(Problem_Description, '"Invalid use of null"')
AND Problem_Status = 'Open'
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"CSHARPITPRO" <CSHARPITPRO@.discussions.microsoft.com> wrote in message
news:95B2EA60-F534-46EA-A4F4-C39A447C5FC9@.microsoft.com...
>I need some help with this syntax
> Select * FROM PROJECTS
> WHERE CONTAINS(Problem_Description, '"Invalid use of null"') And WHERE
> CONTAINS(Problem_Status, '"Open"')
> Can you have multiple CONTAINS Statements?
> I am getting a syntax error with the above code snippet. What am I
> missing?
> Thanks!
>|||Thanks for your help!
"Adam Machanic" wrote:

> You have an extra WHERE clause. CONTAINS is a predicate, and you can
> logically combine predicates using AND or OR; you only need one WHERE
> clause:
> WHERE CONTAINS(x, 'abc') AND CONTAINS(y, 'def')
> But in your case, I'm wondering if you really want to use full-text search
> for your problem status column? Will the status really be more than one
> word? You'd probably have much better luck using:
> WHERE CONTAINS(Problem_Description, '"Invalid use of null"')
> AND Problem_Status = 'Open'
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "CSHARPITPRO" <CSHARPITPRO@.discussions.microsoft.com> wrote in message
> news:95B2EA60-F534-46EA-A4F4-C39A447C5FC9@.microsoft.com...
>
>

Saturday, February 25, 2012

Multiple BinaryWrite() calls

I have two byte[] arrays, objResult1 and objResult2, which contain data from
two separate calls to Render().
I would like to somehow write the results for both reports to the Reponse
object.
This is the code I have:
HttpResponse objResponse = System.Web.HttpContext.Current.Response;
objResponse.ClearContent();
objResponse.ClearHeaders();
string fileName = Path.GetFileName(this.ReportPath) +
".pdf";
objResponse.ContentType = this.strMimeType;
objResponse.AddHeader ("content-disposition",
"attachment; filename=\"" + fileName + "\"");
objResponse.BinaryWrite(objResult1);
objResponse.BinaryWrite(objResult2);
objResponse.Flush();
objResponse.Close();
Unfortunately when I do this, the contents of objResult1 are not visible
i.e. the 2nd call to BinaryWrite overwrites the first one.
How can i simply append the second byte array?
Any help will be much appreciated...
Thanks.You can combine two arrays by using static Array.Copy call. Just create a
new array sized as a sum of two and copy your array one by
one to the new one. Be aware, if the mime types of the webresponses are
different you'll get a garbled output.
Also, BinaryWrite should not override the previous write.
The reason of missing the first write is writing file header information
twice, thus only one will be visible, if you lucky enough, otherwise you can
get some garbage
I'd use frames or iframes, if needed to display output from two different
pages on a single one.
"Aparna" <Aparna@.discussions.microsoft.com> wrote in message
news:53A315A1-FFD7-48BF-99D0-84D63BD062C3@.microsoft.com...
>I have two byte[] arrays, objResult1 and objResult2, which contain data
>from
> two separate calls to Render().
> I would like to somehow write the results for both reports to the Reponse
> object.
> This is the code I have:
> HttpResponse objResponse => System.Web.HttpContext.Current.Response;
> objResponse.ClearContent();
> objResponse.ClearHeaders();
> string fileName = Path.GetFileName(this.ReportPath) +
> ".pdf";
> objResponse.ContentType = this.strMimeType;
> objResponse.AddHeader ("content-disposition",
> "attachment; filename=\"" + fileName + "\"");
> objResponse.BinaryWrite(objResult1);
> objResponse.BinaryWrite(objResult2);
> objResponse.Flush();
> objResponse.Close();
> Unfortunately when I do this, the contents of objResult1 are not visible
> i.e. the 2nd call to BinaryWrite overwrites the first one.
> How can i simply append the second byte array?
> Any help will be much appreciated...
> Thanks.