Showing posts with label based. Show all posts
Showing posts with label based. Show all posts

Tuesday, March 27, 2012

Adding A Multivalue Parameter

I've got a simple report built that retrieves data based on a serial
number assign to each record. The user has to type the serial number
into the box to run the report. Now I would like to add another
parameter in which they can run the report based on either a date/time
stamp (Start - End) and/or a multivalue parameter from another field
in each record. Do I need to create a new dataset to add these
features to the report ? I've tried adding the multivalue parameter
but either get an error or the drop down is empty.
Thank-you
JeffOn Feb 5, 4:04 pm, jsvi...@.gmail.com wrote:
> I've got a simple report built that retrieves data based on a serial
> number assign to each record. The user has to type the serial number
> into the box to run the report. Now I would like to add another
> parameter in which they can run the report based on either a date/time
> stamp (Start - End) and/or a multivalue parameter from another field
> in each record. Do I need to create a new dataset to add these
> features to the report ? I've tried adding the multivalue parameter
> but either get an error or the drop down is empty.
> Thank-you
> Jeff
If the original dataset is based on a serial number parameter/etc that
always has a value/default value, you should be ok. Of course, you
will want to have this multivalue parameter as the second parameter in
the list (behind the parameter it is dependent on). If this does not
work, then you might want to try adding an additional dataset as you
mentioned. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||On Feb 5, 8:41=A0pm, EMartinez <emartinez...@.gmail.com> wrote:
> On Feb 5, 4:04 pm, jsvi...@.gmail.com wrote:
> > I've got a simple report built that retrieves data based on a serial
> > number assign to each record. The user has to type the serial number
> > into the box to run the report. Now I would like to add another
> > parameter in which they can run the report based on either a date/time
> > stamp (Start - End) and/or a multivalue parameter from another field
> > in each record. Do I need to create a new dataset to add these
> > features to the report ? I've tried adding the multivalue parameter
> > but either get an error or the drop down is empty.
> > Thank-you
> > Jeff
> If the original dataset is based on a serial number parameter/etc that
> always has a value/default value, you should be ok. Of course, you
> will want to have this multivalue parameter as the second parameter in
> the list (behind the parameter it is dependent on). If this does not
> work, then you might want to try adding an additional dataset as you
> mentioned. Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
I would like to be able to use each parameter independently or
together if possible. Here is the report query that I started with:
SELECT SpindleName AS Tool, Timestamp AS [Date-Time], Accept,
FinalAngle AS Angle, PartId AS CSN, CycleStatus AS Status, PeakTorque
AS Torque
FROM Readings
WHERE (PartId =3D @.PartId)
ORDER BY CSN DESC
The user types the CSN number in a gets a report showing the data for
every tool. I'd like to allow them to run the report based on
selecting one or more specific tools with or without a dependancy on
the CSN number. Is this possible ?
Thanks
Jeff

Thursday, March 22, 2012

Adding a column to a Fact table in Analysis Services 2000

How do you add a column to a fact table?

I added a column to the SQL table that the cube is based on "FactVoyage". I then went to Analysis Manager refreshed everything, and edited the cube. the table "FactVoyage" shows on the Schema tab, but the new column does not appear. I presume there is some trick apart from deleting the Table and reinserting it?

Thanks

Ignore that! There is something totally dodgey with the datasource so I need to fix that first

Tuesday, March 20, 2012

Add values to a table based on values in another table

When a record is inserted or updated records in Table1 I want a record to be inserted into table3 for each record ID that is in table2 if the table2.id does not already exist in table3. What is the best way to do this? Could this be done with a trigger? If it could how would I write such a trigger. I have never written one before and this sounds like a hand full for my first effort. Your help will be greatly appreciated.

Thanks

You could do it in a trigger. They're really not hard. It's just SQL you want to run whenever a certain action happens on your table. Pretty straightforward. Another option is to use stored procedures to do all of your inserts and updates. Then, just code what could go in the trigger directly into your stored procedure.

Pete

Tuesday, March 6, 2012

Add leading zero to field value via SP

Hi All,

I want to add a leading zero to a field based on a param that I create on the fly in my stored proc. I have a @.month which is created from my datetime param @.date.

@.Month needs to be char(2) but if the month is inputted as '04' I get '4 ' in the table (note the space after 4)

How can I add a leading zero to this field?
Set @.Year = right('0',1)year(@.Date) is spitting it's toys out.

Thanks,
Brett

prepend a '0' char to the front of it and take RIGHT('0'+yourString,2)

Thursday, February 16, 2012

Add a new SQL2000 node

Based on the other threads I've read in the group, I'd like to confirm
the steps needed to perform to add a third node to a cluster that has
been running for a while on 2 nodes...
After adding the new node to the cluster, for each instance in the
cluster (assume: each instance is its own cluster group):
1) Run SQL2000 setup from CD on one of the older nodes; instruct setup
to add the new node as a target for failover.
2) Move the cluster group, making it active on the new node.
3) Install SQL2000 SP4 to the instance from the new node.
Am I missing any steps? Are there additional hotfixes (post-SP4) that
should be installed?
The current (active/active) cluster is running on Win2003 ENT SP1, while
the new node already has Win2003 ENT R2 SP2. The plan is to upgrade the
older hosts to the same rev after the new node is up. Is this workable?
To minimize downtime, you don't have to move any groups to apply SP4.
Rather, from the new node, apply SP4. After that, move the SQL group and
apply the post-SP4 hotfix.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"horseradish" <millardjk@.gmail.com> wrote in message
news:O5L1VrQjHHA.4132@.TK2MSFTNGP05.phx.gbl...
Based on the other threads I've read in the group, I'd like to confirm
the steps needed to perform to add a third node to a cluster that has
been running for a while on 2 nodes...
After adding the new node to the cluster, for each instance in the
cluster (assume: each instance is its own cluster group):
1) Run SQL2000 setup from CD on one of the older nodes; instruct setup
to add the new node as a target for failover.
2) Move the cluster group, making it active on the new node.
3) Install SQL2000 SP4 to the instance from the new node.
Am I missing any steps? Are there additional hotfixes (post-SP4) that
should be installed?
The current (active/active) cluster is running on Win2003 ENT SP1, while
the new node already has Win2003 ENT R2 SP2. The plan is to upgrade the
older hosts to the same rev after the new node is up. Is this workable?
|||There's no need to move the cluster group unless you want to test it will
correctly will startup.
For the SP4. If i Remember well Setup will detect that there's only one node
missing for the SP4 binnaries and will update only that node without
affecting the others.
Hope this helps.
Regards.
FR.
"horseradish" wrote:

> Based on the other threads I've read in the group, I'd like to confirm
> the steps needed to perform to add a third node to a cluster that has
> been running for a while on 2 nodes...
> After adding the new node to the cluster, for each instance in the
> cluster (assume: each instance is its own cluster group):
> 1) Run SQL2000 setup from CD on one of the older nodes; instruct setup
> to add the new node as a target for failover.
> 2) Move the cluster group, making it active on the new node.
> 3) Install SQL2000 SP4 to the instance from the new node.
> Am I missing any steps? Are there additional hotfixes (post-SP4) that
> should be installed?
> The current (active/active) cluster is running on Win2003 ENT SP1, while
> the new node already has Win2003 ENT R2 SP2. The plan is to upgrade the
> older hosts to the same rev after the new node is up. Is this workable?
>
|||Tom Moreau wrote:
> To minimize downtime, you don't have to move any groups to apply SP4.
> Rather, from the new node, apply SP4. After that, move the SQL group and
> apply the post-SP4 hotfix.
>
Based on other things I've seen, it appears that I should be able to add
two nodes (my ultimate plan is to get to 3 nodes using two new and one
current host) to the SQL cluster simultaneously, either when installing
SQL2K RTM _or_ SP4.
Then, once I have my 4-node cluster running, I can uninstall from SQL
and MSCS the one node I wish to remove.
Or will I have to fully install & patch the first new node before I can
repeat with the second?
|||You're probably safer to patch as you go. What if there was a failover in
the middle of what you're doing? It's best to have new nodes like the old
one as soon as you can.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"horseradish" <millardjk@.gmail.com> wrote in message
news:Otdi2JojHHA.4896@.TK2MSFTNGP02.phx.gbl...
Tom Moreau wrote:
> To minimize downtime, you don't have to move any groups to apply SP4.
> Rather, from the new node, apply SP4. After that, move the SQL group and
> apply the post-SP4 hotfix.
>
Based on other things I've seen, it appears that I should be able to add
two nodes (my ultimate plan is to get to 3 nodes using two new and one
current host) to the SQL cluster simultaneously, either when installing
SQL2K RTM _or_ SP4.
Then, once I have my 4-node cluster running, I can uninstall from SQL
and MSCS the one node I wish to remove.
Or will I have to fully install & patch the first new node before I can
repeat with the second?
|||Tom Moreau wrote:
> You're probably safer to patch as you go. What if there was a failover in
> the middle of what you're doing? It's best to have new nodes like the old
> one as soon as you can.
>
Thanks! The safer way is the right way for this implementation...
|||Tom Moreau wrote:
> To minimize downtime, you don't have to move any groups to apply SP4.
> Rather, from the new node, apply SP4. After that, move the SQL group and
> apply the post-SP4 hotfix.
>
Which HF is 'the post-SP4 hotfix'?
|||Check out:
http://aspfaq.com/SQL2000Builds.asp
The hotfix to correct the AWE issue is build 8.00.2040. There have been
subsequent fixes, which are cumulative, so you could apply a later one
instead.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"horseradish" <millardjk@.gmail.com> wrote in message
news:%23rObwnioHHA.4412@.TK2MSFTNGP02.phx.gbl...
Tom Moreau wrote:
> To minimize downtime, you don't have to move any groups to apply SP4.
> Rather, from the new node, apply SP4. After that, move the SQL group and
> apply the post-SP4 hotfix.
>
Which HF is 'the post-SP4 hotfix'?

Monday, February 13, 2012

Add a column to a view

hello,
I am trying to add a column to a view. This is a generic column not pulling
from the other tables but will be updated based on the values of the other
columns.
I thought I simply altering the view and add a column and set a value, if
the other values were found true. However, it is not allowing me to add a
column unless it is a integer value. Any suggestions?you cannot add a column here.
You use alter view to change the vew definition. You will have to give the
full sql stament with the computed column (if I am not wrong) in the view.
use it this way. Its very similar to create view just the keyword create is
replaced by alter. Hope this helps.
alter view vname
as
select .... col1 + col2 as new_col
from table1
where <conditions>|||> I thought I simply altering the view and add a column and set a value, if
> the other values were found true. However, it is not allowing me to add a
> column unless it is a integer value.
What does "not allowing" mean? Can you show the DDL for the table
referenced in the view, the existing code for the view, the change you are
attempting, and the exact text of the error? A lot of the people here are
pretty smart, but not many are psychic.
A|||Well, I tried to alter the view but it not giving me what I want.
Currently, I am pulling all the columns from other tables. However, I want
to create a new column called columnD and set it to 1 if columnA, columnB an
d
columnC are 1 else set it to 0.
"Omnibuzz" wrote:

> you cannot add a column here.
> You use alter view to change the vew definition. You will have to give the
> full sql stament with the computed column (if I am not wrong) in the view.
> use it this way. Its very similar to create view just the keyword create i
s
> replaced by alter. Hope this helps.
> alter view vname
> as
> select .... col1 + col2 as new_col
> from table1
> where <conditions>|||Are you using Query Analyzer or the view editor in Enterprise Manager? What
code are you trying to run? This sounds like it needs a CASE expression,
and the ability to understand CASE is a serious limitation in Enterprise
Manager. As I asked before, if you can provide *SPECIFIC* information, we
may be able to help.
"Sonya" <Sonya@.discussions.microsoft.com> wrote in message
news:9240DFD4-B5A0-482B-B64E-AE13F3B31E4E@.microsoft.com...
> Well, I tried to alter the view but it not giving me what I want.
> Currently, I am pulling all the columns from other tables. However, I want
> to create a new column called columnD and set it to 1 if columnA, columnB
> and
> columnC are 1 else set it to 0.
> "Omnibuzz" wrote:
>|||>I have it sort of working but it is not totally correct. So i am sing a
> better way in adding a column to the view based on the below criteria.
And I'd like my car to run better! But if I can't be bothered to give my
mechanic more information, he's going to tell me to go jump off a bridge...|||Since you haven't given the defn, I have created a sample. See if this is
what you wnted. Hope this helps.
create table tbl (a int,b int,c int)
go
insert into tbl values (1,1,1)
insert into tbl values (1,1,0)
create view vw1
as
select a,b,c from tbl
select * from vw1
-- till above was your setup...
--now do this
alter view vw1
as
select a,b,c, case when a=b and b=c and c=1 then 1 else 0 end as d
from tbl
select * from vw1|||Initially,
I wrote to add columnD
alter view sam_generic
AS
select columnD, a.columnA, a.columnB,a. columnC, m.member, v.history,
u.category, c.content, l.letter
from tableA AS a INNER JOIN
tableU on a.category = u.category LEFT OUTER JOIN
tableC on a.id = c.id LEFT OUTER JOIN
tableL on a.id = l.id LEFT OUTER JOIN
tableM on a.id = m.id LEFT OUTER JOIN
tableV on a.id =v.id
Set columnD = 1 Where Exists (a.columnA = 1) AND (if a.columnB = 1) AND (if
(a. columnC=1)
"Aaron Bertrand [SQL Server MVP]" wrote:

> What does "not allowing" mean? Can you show the DDL for the table
> referenced in the view, the existing code for the view, the change you are
> attempting, and the exact text of the error? A lot of the people here are
> pretty smart, but not many are psychic.
> A
>
>|||I was using query analyzer. I didn't think about using case statements. I'll
try that.
"Aaron Bertrand [SQL Server MVP]" wrote:

> Are you using Query Analyzer or the view editor in Enterprise Manager? Wh
at
> code are you trying to run? This sounds like it needs a CASE expression,
> and the ability to understand CASE is a serious limitation in Enterprise
> Manager. As I asked before, if you can provide *SPECIFIC* information, we
> may be able to help.
>
>
> "Sonya" <Sonya@.discussions.microsoft.com> wrote in message
> news:9240DFD4-B5A0-482B-B64E-AE13F3B31E4E@.microsoft.com...
>
>|||I was submiting the information that you requested. I was working on multipl
e
tasks, so give me a minute to send the information to you.
"Aaron Bertrand [SQL Server MVP]" wrote:

> And I'd like my car to run better! But if I can't be bothered to give my
> mechanic more information, he's going to tell me to go jump off a bridge..
.
>
>