|
Perhaps it would be easiest to use something like:
...
WHERE NOT EXISTS( SELECT 1
FROM attendance
WHERE attendance.class_id = class_held.class_id
AND attendance.absentees = student.id)
|
|
|
|
|
Hello Mika,
Thanks a lot...I got that correct..
Regards,
HimangshuS
I am a learner Always
|
|
|
|
|
Hi,
I am having database files in .dbf format.I am new to Foxpro database.Now i want to convert those foxpro database files to Sql server. Can you guide me is there any other tools to convert .Dbf files to Sql server(.mdf,.ldf).Its very urgent to me if you know please suggest me.
Thanks in Advance
Pavani
|
|
|
|
|
|
hi all,
i want to create a trigger on table through a stored procedure but i got error in excuting the script
it say syntax problem near word TRIGGER
CREATE PROCEDURE CreateMyTrigger
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
CREATE TRIGGER [dbo].[InsertQuestionTrigger]
ON [dbo].[Question]
FOR INSERT AS
UPDATE child
-- set the depth of this "child" to be the
-- depth of the parent, plus one.
SET depth = ISNULL(parent.depth + 1,0),
-- the lineage is simply the lineage of the parent,
-- plus the child's ID (and appropriate '/' characters
lineage = ISNULL(parent.lineage,'/') + LTrim(Str(child.QuestionId)) + '/'
-- we can't update the "inserted" table directly,
-- so we find the corresponding child in the
-- "real" table
FROM Question child INNER JOIN inserted i ON i.QuestionId=child.QuestionId
-- now, we attempt to find the parent of this
-- "child" - but it might not exist, so these
-- values may well be NULL
LEFT OUTER JOIN Question parent ON child.IdParent=parent.QuestionId
END
GO
Any Idea and how can create trigger using function or stored procedure.
Thank you in advance!
|
|
|
|
|
Instead of writing the trigger creation directly to the stored procedure, put it in a varchar variable. Then you can use EXECUTE[^] to execute the string.
|
|
|
|
|
for example;
declare @query varchar(500)
set @query = "your trigger create here, I would suggest using not exists clause to prevent you from trying to create it when it is already created "
EXECUTE @query
Good luck
|
|
|
|
|
Hi All,
I know "TOP" Function can select the TOP n records. How can I select records from for example 20 to 50? I know SQL server doesn't have "LIMIT" Function....
Thanks
Tin
|
|
|
|
|
|
Thanks for your reply, I able to create the row number column but when I tried to select a range of row number. It appeared this error message "
Conversion failed when converting the varchar value 'Row_Number' to data type int"
I have used cast and convert already.
Any idea?
Tin
|
|
|
|
|
Could you post the query so it would be easier to see the problem
|
|
|
|
|
Hi,
what you oculd also try is something like this...
SELECT top(20)* FROM _yourtable
WHERE _tableID not in (select top(20) tableID from _yourtable)
|
|
|
|
|
Hi friends,
Is any tutorial or useful link for stored procedure optimization with example.
I searched in google.But it is not enough. Please if you know send me,
Hope your's reply.
Thanks & Regards
Every Successful Person Have A Painful Story
|
|
|
|
|
|
Hi mik
Thanks for yours reply.
Every Successful Person Have A Painful Story
|
|
|
|
|
I have been listening so many different answer to question of favorite database. I would like to know what is favorite database of SQLAuthority.com readers. I encourage all of you to participate in this poll. It is very quick poll and takes a second.
A gift of USB drive will be provided to user who will also add comment discussing this subject matter. I encourage to send emails to your friends to participate in poll. I am hopping this poll becomes landmark poll for people who are finding answer to favorite database.
http://blog.sqlauthority.com/2009/02/25/the-poll-what-is-your-favorite-database/[^]
Kind Regards,
Pinal Dave
|
|
|
|
|
pinaldave wrote: I would like to know what is favorite database of SQLAuthority.com readers. I encourage all of you to participate in this poll.
Since I don't read SQLAuthotity.com, I only heard of it just a moment ago, if I participated then it would skew your results. It would no longer be a poll of favourite databases of SQLAuthority.com readers.
|
|
|
|
|
Hi,
It is not for my readers only.I would like to collect data from every developer in world.
Please participate in poll.
Kind Regards,
Pinal
|
|
|
|
|
pinaldave wrote: I would like to collect data from every developer in world
Good luck with that. Most marketing companies have the view that if they get a response from 1% of the audience they are doing exceptionally well.
Heck! Many elections can struggle to get 50% turn out.
|
|
|
|
|
Hi friend,
I have a doubt. Could you clear my doubt?
Actually what is raising events available in stored procedure?
If it is yes, how can we implement and test?
Is any useful link or tutorial available for raising events in sp?
Hope yours reply.
Thanks & Regards
Every Successful Person Have A Painful Story
|
|
|
|
|
Programming in T-SQL isn't event based so you cannot use events like you would in Visual Studio. However, yuo can use for example Queues[^].
|
|
|
|
|
In stored procedure we use sp_sendmail and send sms, other notification are all events?What about that.
Every Successful Person Have A Painful Story
|
|
|
|
|
Guvera wrote: In stored procedure we use sp_sendmail and send sms, other notification are all events?What about that
There are several ways of notifying info from the database: mail, sms, queues, file writes, alerts etc. but none of these are events as they're defined for example in C#.
Since you haven't provided any more info about what you actually want to do, it's hard to say what would be a good choice in your situation.
|
|
|
|
|
how to identify tokens in a sql statement
|
|
|
|
|
I believe that the previous answer also covers this: see[^].
|
|
|
|