Wednesday, March 28, 2012
Multiple Instances of Sql Server on a machine.
connection string that provides the name of the server machine that
sql-server resides on. What do we do when there is more than one sql-server
on that machine. For example, there are instances A,B, and C on the machine
and we want to work with instance B. What changes do we need to make to our
connection string to make this happen? We aren't using DSN's by the way.
Thanks in advance for any assistance.Ed Hawkes wrote:
> We are currently writing software that connects to Sql server 2000.
> We use a connection string that provides the name of the server
> machine that sql-server resides on. What do we do when there is more
> than one sql-server on that machine. For example, there are instances
> A,B, and C on the machine and we want to work with instance B. What
> changes do we need to make to our connection string to make this
> happen? We aren't using DSN's by the way. Thanks in advance for any
> assistance.
Provide the instance name (SERVERNAME\INSTANCENAME)
David Gugick
Imceda Software
www.imceda.com
Monday, March 26, 2012
multiple inserted
on a different table. so how can i grab the info that is inserted in one
table to use in a query in another trigger.
thanks.seeker53 wrote:
> I am writing a trigger on one table that has dependency on what is
> inserted on a different table. so how can i grab the info that is
> inserted in one table to use in a query in another trigger.
> thanks.
Use the "inserted" virtual table from the insert trigger. It contains
all the rows that were inserted in the table in a DDL format that
matches the underlying table.
--
David Gugick
Imceda Software
www.imceda.com|||Here is the existing trigger:
if exists(select count(b.begin_datetime)
from inserted a inner join tblevent b on a.event_sysid =b.event_sysid
inner join tblparticipating_entity c on a.entity_id =c.entity_id
where a.entity_type_code = 'c'
group by a.entity_type_code, b.begin_datetime
having count(b.begin_datetime) >1 and b.begin_datetime >='1/14/05')
begin
select @.errno = 30080,
@.errmsg = 'begin_datetime: Appointments can not be same day dated.'
goto error
end
this inserted will only give data inserted into the tblparticipating_entity
table but in the above query I also need the inserted value of begin_datetime
which is in the tblevent. As this trigger stands now data exists and so the
trigger is fired but I need the query to filter down to the inserted consumer
which is in the participating_entity inserted virtual table and also the
inserted begin_datetime which is in the tblevent inserted virtual table.
What I want the trigger to do is give an alert to a scheduler that a
consumer can not have more than one appointment in a day. Thanks.
"David Gugick" wrote:
> seeker53 wrote:
> > I am writing a trigger on one table that has dependency on what is
> > inserted on a different table. so how can i grab the info that is
> > inserted in one table to use in a query in another trigger.
> >
> > thanks.
> Use the "inserted" virtual table from the insert trigger. It contains
> all the rows that were inserted in the table in a DDL format that
> matches the underlying table.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||On Fri, 14 Jan 2005 05:53:15 -0800, seeker53 wrote:
>Here is the existing trigger:
>if exists(select count(b.begin_datetime)
> from inserted a inner join tblevent b on a.event_sysid =>b.event_sysid
> inner join tblparticipating_entity c on a.entity_id =>c.entity_id
> where a.entity_type_code = 'c'
> group by a.entity_type_code, b.begin_datetime
> having count(b.begin_datetime) >1 and b.begin_datetime >=>'1/14/05')
> begin
> select @.errno = 30080,
> @.errmsg = 'begin_datetime: Appointments can not be same day dated.'
> goto error
> end
Hi seeker53,
This trigger will always show the error message, regardless of the data
you actually tried to insert or update.
The subquery calculates a COUNT. If no single row matches the WHERE and
HAVING clauses of the subquery, the result of COUNT(..) will be 0 (the
number zero, not the letter ooh, nor the "absence symbol" NULL). So the
subquery will return 1 row (with the value 0 as data) and the exists
clause will be evaulated as true.
Another problem with your trigger code is that the date format 1/14/05 is
ambiguous. The only safe format for dates is yyyymmdd (20050114). Oh, and
hard coding todays date is not really a best practice either - unless you
really have a strong desire to go and manually edit this date every day
from now on!
I'd like to give you some suggestions how to rewrite this trigger, but to
tell you the truth, I have no idea what you're trying to accomplish, how
your tables look, etc. Please have a look at www.aspfaq.com/5006.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
multiple inserted
on a different table. so how can i grab the info that is inserted in one
table to use in a query in another trigger.
thanks.
seeker53 wrote:
> I am writing a trigger on one table that has dependency on what is
> inserted on a different table. so how can i grab the info that is
> inserted in one table to use in a query in another trigger.
> thanks.
Use the "inserted" virtual table from the insert trigger. It contains
all the rows that were inserted in the table in a DDL format that
matches the underlying table.
David Gugick
Imceda Software
www.imceda.com
|||Here is the existing trigger:
if exists(select count(b.begin_datetime)
from inserted a inner join tblevent b on a.event_sysid =
b.event_sysid
inner join tblparticipating_entity c on a.entity_id =
c.entity_id
where a.entity_type_code = 'c'
group by a.entity_type_code, b.begin_datetime
having count(b.begin_datetime) >1 and b.begin_datetime >=
'1/14/05')
begin
select @.errno = 30080,
@.errmsg = 'begin_datetime: Appointments can not be same day dated.'
goto error
end
this inserted will only give data inserted into the tblparticipating_entity
table but in the above query I also need the inserted value of begin_datetime
which is in the tblevent. As this trigger stands now data exists and so the
trigger is fired but I need the query to filter down to the inserted consumer
which is in the participating_entity inserted virtual table and also the
inserted begin_datetime which is in the tblevent inserted virtual table.
What I want the trigger to do is give an alert to a scheduler that a
consumer can not have more than one appointment in a day. Thanks.
"David Gugick" wrote:
> seeker53 wrote:
> Use the "inserted" virtual table from the insert trigger. It contains
> all the rows that were inserted in the table in a DDL format that
> matches the underlying table.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
|||On Fri, 14 Jan 2005 05:53:15 -0800, seeker53 wrote:
>Here is the existing trigger:
>if exists(select count(b.begin_datetime)
> from inserted a inner join tblevent b on a.event_sysid =
>b.event_sysid
> inner join tblparticipating_entity c on a.entity_id =
>c.entity_id
> where a.entity_type_code = 'c'
> group by a.entity_type_code, b.begin_datetime
> having count(b.begin_datetime) >1 and b.begin_datetime >=
>'1/14/05')
> begin
> select @.errno = 30080,
> @.errmsg = 'begin_datetime: Appointments can not be same day dated.'
> goto error
> end
Hi seeker53,
This trigger will always show the error message, regardless of the data
you actually tried to insert or update.
The subquery calculates a COUNT. If no single row matches the WHERE and
HAVING clauses of the subquery, the result of COUNT(..) will be 0 (the
number zero, not the letter ooh, nor the "absence symbol" NULL). So the
subquery will return 1 row (with the value 0 as data) and the exists
clause will be evaulated as true.
Another problem with your trigger code is that the date format 1/14/05 is
ambiguous. The only safe format for dates is yyyymmdd (20050114). Oh, and
hard coding todays date is not really a best practice either - unless you
really have a strong desire to go and manually edit this date every day
from now on!
I'd like to give you some suggestions how to rewrite this trigger, but to
tell you the truth, I have no idea what you're trying to accomplish, how
your tables look, etc. Please have a look at www.aspfaq.com/5006.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
multiple inserted
on a different table. so how can i grab the info that is inserted in one
table to use in a query in another trigger.
thanks.seeker53 wrote:
> I am writing a trigger on one table that has dependency on what is
> inserted on a different table. so how can i grab the info that is
> inserted in one table to use in a query in another trigger.
> thanks.
Use the "inserted" virtual table from the insert trigger. It contains
all the rows that were inserted in the table in a DDL format that
matches the underlying table.
David Gugick
Imceda Software
www.imceda.com|||Here is the existing trigger:
if exists(select count(b.begin_datetime)
from inserted a inner join tblevent b on a.event_sysid =
b.event_sysid
inner join tblparticipating_entity c on a.entity_id =
c.entity_id
where a.entity_type_code = 'c'
group by a.entity_type_code, b.begin_datetime
having count(b.begin_datetime) >1 and b.begin_datetime >=
'1/14/05')
begin
select @.errno = 30080,
@.errmsg = 'begin_datetime: Appointments can not be same day dated.'
goto error
end
this inserted will only give data inserted into the tblparticipating_entity
table but in the above query I also need the inserted value of begin_datetim
e
which is in the tblevent. As this trigger stands now data exists and so the
trigger is fired but I need the query to filter down to the inserted consume
r
which is in the participating_entity inserted virtual table and also the
inserted begin_datetime which is in the tblevent inserted virtual table.
What I want the trigger to do is give an alert to a scheduler that a
consumer can not have more than one appointment in a day. Thanks.
"David Gugick" wrote:
> seeker53 wrote:
> Use the "inserted" virtual table from the insert trigger. It contains
> all the rows that were inserted in the table in a DDL format that
> matches the underlying table.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||On Fri, 14 Jan 2005 05:53:15 -0800, seeker53 wrote:
>Here is the existing trigger:
>if exists(select count(b.begin_datetime)
> from inserted a inner join tblevent b on a.event_sysid =
>b.event_sysid
> inner join tblparticipating_entity c on a.entity_id =
>c.entity_id
> where a.entity_type_code = 'c'
> group by a.entity_type_code, b.begin_datetime
> having count(b.begin_datetime) >1 and b.begin_datetime >=
>'1/14/05')
> begin
> select @.errno = 30080,
> @.errmsg = 'begin_datetime: Appointments can not be same day date
d.'
> goto error
> end
Hi seeker53,
This trigger will always show the error message, regardless of the data
you actually tried to insert or update.
The subquery calculates a COUNT. If no single row matches the WHERE and
HAVING clauses of the subquery, the result of COUNT(..) will be 0 (the
number zero, not the letter ooh, nor the "absence symbol" NULL). So the
subquery will return 1 row (with the value 0 as data) and the exists
clause will be evaulated as true.
Another problem with your trigger code is that the date format 1/14/05 is
ambiguous. The only safe format for dates is yyyymmdd (20050114). Oh, and
hard coding todays date is not really a best practice either - unless you
really have a strong desire to go and manually edit this date every day
from now on!
I'd like to give you some suggestions how to rewrite this trigger, but to
tell you the truth, I have no idea what you're trying to accomplish, how
your tables look, etc. Please have a look at www.aspfaq.com/5006.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Friday, March 23, 2012
Multiple Filtering on the same field using a Stored Procedure
Hello,
I am looking at writing a SP without much success which enables multiple filtering on one field. Something like below:
Input field: Product Description
So if the user enters: "Large Drill" OR "Drill Large" the same resultset will be returned.
SELECT * FROM products WHERE products.prod_desc contains both "Large" AND "Drill"
I guess there'll need to be a nested Select and loop to parse the space separated input field.
Any pointers would be appreciated.
Thank you
Lee
hi dear,
I answer the same question on MSDN forum....you can reach this via this link
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1448983&SiteID=1
Thank You
Best Regards,
Muhammad Akhtar Shiekh
|||Thank you very much Muhammad
Problem solved.
Wednesday, March 7, 2012
Multiple columns
I'm writing a report with multiple columns and have a couple
of questions.
First, I have the report set to have three columns. When I
view the report
in the preview tab I see only one column but it exports to
PDF with three columns.
Is there a reason why it won't display properly in the
preview tab?
Secondly, it exports to excel with only one column. Does
export to excel support multiple columns?
Last, is there any way to automatically keep the column
rows even?
As always thanks for any help.
Multi-column is only supported in PDF and Image formats. Not in preview. You can change how many rows are in each column by using RowNumber function to control the pagebreaks http://msdn2.microsoft.com/en-us/library/ms157328.aspx.|||Already had it set to 3 columns.Thanks your info is what I was looking for.