|
Tables
People
Address
PeopleType
lnkPeopleType - many to many link between people and type (client can also pe a practitioner)
AddressType attribute on address (you may want multiple links if you need to have the same address for 2 types)
This is a heavily normalised structure and is a pain to use so create a view based on the PeopleType.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In SQL Server, I was doing this in the stored procedure:
param_record_id int OUTPUT
then I :
set param_record_id = scope_identity()
how can id o the same in mySQL stored procedure?
|
|
|
|
|
jrahma wrote: how can id o the same in mySQL stored procedure?
select sequence_name_goes_here.currval
from dual;
There's an example both on using sequences and returning values in the manual over here[^]
I are Troll
|
|
|
|
|
With SQL server, it is easy to have multiple select statements in a stored procedure, the outputs for the select statements are just tables in the output data set. Is it possible to do this in Oracle?
Thanks.
|
|
|
|
|
Yes. Have a look at this[^] thread to get some ideas.
|
|
|
|
|
I looked at the link you provided: It is not the same thing. The solution provided requires two select statements to return the same number of columns and the column types have to match. While in SQL server, you can have an arbitrary number of select statements and arbitrary data types.
I guess the answer to my question is NO. Thanks.
|
|
|
|
|
Here's[^] an example, scroll down to "Returning Results with Oracle REF CURSORs"
The example is for a DataReader, but the same principle applies to a DataAdapter.
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
That looks like a good solution. Thanks.
|
|
|
|
|
You're welcome.
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
i have configure the mail in sql server but when i am sending mail from sql server it is showing mail queue message but i am not getting the mail. i also grant the permission to msdb.dbo.sp_send_dbmail sp for public.
my mail sending code as follows.
EXEC msdb.dbo.sp_send_dbmail @recipients='test@bba-reman.com',
@subject = 'test',
@body = 'Test',
@body_format = 'HTML';
i just do not understand why i am not getting mail where as i am getting mail queue message when sending.
please guide me.
tbhattacharjee
|
|
|
|
|
Are you sure your smtp works as expected and not blocked from the subnet you trying to send the email?
You need dbMailUser permission for the id that trying to send email under msdb as well.
Please confirm.
Thank you.
Amit...
|
|
|
|
|
which version of SQL server are you using?
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
hi,
I am using SQL Server 2005 database.
I stored Thumb Image on two tables to the Image data type field.
When I compare these two images from both table is gives error...
"The data types image and image are incompatible in the equal to operator"
Statement :
"Select FP1 From E_CH16APPLICANTS Where FP1 In (Select Photo From Tmp)"
I just like to verify that this Thumb Image is exist or not...
by using SQL Statement...
Pls help me...
|
|
|
|
|
check for NULL or DBNULL, or use IsNull; or something like that. No need to actually compare anything if I understood your question correctly.
|
|
|
|
|
Exactly I want to know...
Can I Compare two Images stored in the Table...?????
|
|
|
|
|
I'm no database expert at all, however I've never seen SQL code that compares big fields (blobs, images), and I expect that whenever you (think you) need it, you have a bad design to start with; there should be no doubt that the image, when present, is the right one (the only doubt I would allow for is whether the image is present at all); and IMO it would most always be wise to have a separate field that uniquely identifies the image (a hash or CRC would probably be fine).
The only way I know to compare two blobs/images is by using a programming language (say C#), fetch the two blobs and compare their elements in a loop.
|
|
|
|
|
One LIKE operation may help you to compare two image field.
Here [^] is a link on Brief Tutorial on Text, Ntext, and Image. You will also find a example how to compare two image column
|
|
|
|
|
Convert Image field in Varbinary(Max)
Ex:
Select * From E_CH16APPLICANTS
Where (Convert(VARBINARY(MAX), FP1) In (Select Convert(VARBINARY(MAX), Photo) From Tmp)
|
|
|
|
|
Never use select * . As a shortcut, it leads to bad programming habits and it can lead to hard to find bugs as columns get renamed in the underlying database. You should always choose to explicitly select columns instead, partly because using
select * typically results in columns being retrieved that aren't needed in the result set.
|
|
|
|
|
Manish_84 wrote: Convert Image field in Varbinary(Max)
It'd be 'sweet' if you could create a hash to represent your image, and store that in a column next to the image itself
I are Troll
|
|
|
|
|
Does anyone know of a good reference site for SQL Server 2005 Notification Services?
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
Are you thinking of using them? I ask because Notification Services were killed off in SQL Server 2008, which would make an upgrade path tricky to say the least.
|
|
|
|
|
Thanks Pete.. just Google'd that and as its part of the report services I might be rethinking that part that I was going to use notification services
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
Hey all,
I am still fairly knew to SQL query writing, and have searched to try and solve this by myself, however have had no luck!
I am trying to write a query that returns information from SaleInformation and File_Info, with SaleInformation including all records that match a query and File_Info returning the matching File_Name(I have a relationship between them with PID the primary key in File_Info) if the PID is a match.
However, my query is returning a result in every File_Name row return, even though I only have 3 entries in the File_Info PID column that match only 3 records in the Sale_information table. A gentle push in the right direction would be greatly appreciated!
Oh, on a side note - If I change the query to "ON File_Info.PID = SaleInformation.PID" I get the 3 records that match returned. Here is the query I have at the moment:
USE [C:\DATABASE\SALES.MDF]
GO
SELECT File_Info.File_Name, SaleInformation.PID, SaleInformation.Sale_date, SaleInformation.Sale_price
FROM File_Info LEFT OUTER JOIN SaleInformation
ON SaleInformation.Sale_price > 150000
It returns 183 rows. There are only 94 rows in the SaleInformation table and 3 in the File_Info table. I am very confused!
Regards,
Joe
|
|
|
|
|
Joe Stansfield wrote: I have a relationship between them with PID the primary key in File_Info
Perhaps you think that that will somehow automatically affect the join? It doesn't; you need to specify the relationship in the join.
|
|
|
|