Showing posts with label bit. Show all posts
Showing posts with label bit. Show all posts

Thursday, March 8, 2012

Continuously updating a website

Hi,

Bit of a newbee question:

I'm after hosting a website with basically a table in it that is linked to a MS SQL Server 2005 database, which I want to update on a pretty much continual basis from my own server PC which I'm running a data mining tool that updates the MS SQL Server 2005 database.

Any idea on how I would achieve this, or any pointers would be much appreciated.

Cheers,

Tom

One of the better options would be to explore Replication.

Other than that, you could use the Windows Scheduler to run on a predetermined schedule, executing SQLCmd.exe, which could execute a script file or a stored procedure.

Sunday, February 19, 2012

constructing varchar computed column , using bit fields

Hi,
Due to a certain circumstance i have to add a field to my table, which would be a varchar type. this varchar contructs istfel using 4 fields of type bit

so if the table def goes as
isA(bit), isB(bit), isC(bit), isD(bit), ABCD(varchar(4))

the value of the field ABCD should be constructued from the 4 bit fields
if isA,isC is checked then ABCD should be AC
if isA,isB,isD is checked then ABCD should be ABD
is there a way i could achieve it using computed columns or would i have to make a trigger..(which i am also not sure on how to go about it)

Sorry for the trouble, but i couldnt get my head around with starting it either !

thankyouHi,
Updating on what i have done
Created a trigger on insert,update
and with a series of IF statements i contructed the varchar field based on if the bit fields were set to true.

Tuesday, February 14, 2012

constraints on views

Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
Agoston
Create an indexed view with a unique index on (a,b).
David Portas
SQL Server MVP
|||"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:570905D0-1D39-4CAF-995C-2DD91A2EC6B4@.microsoft.com...
> Create an indexed view with a unique index on (a,b).
Does this feature exists in SQL Server 7? Unfortunately I'm forced to work
with that, and I remember reading about this feature not being present in
SQL 7.
Thx,
Agoston

> --
> David Portas
> SQL Server MVP
> --
>
|||You are correct, indexed views are not available in SQL 7. Probably the best
thing you can do in SQL 7 is to create a trigger that enforces this for you.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Agoston Bejo" <gusz1@.freemail.hu> wrote in message
news:evpzFRF2EHA.3408@.tk2msftngp13.phx.gbl...
> Hi.
> At first let me present the problem:
> T(a int, b int, c bit)
> I would like to see to it that (a,b) is unique where c = 1. The easiest
way
> to accomplish this would be creating a view like this:
> create view V as select a,b from T where c = 1
> And then putting a unique constraint on (a,b) in V.
> I am open to other solutions as well, of course.
> Thx,
> Agoston
>
|||It is not clear from your message if you want to use regular view or
indexed view, but in any case you can only have constraint on indexed
view.
Another way that you can use is to work with stored procedure.
Instead of giving the users permissions to work directly with the
table, you can grant them execute permissions on a stored procedure
that inserts the data to the table (or rejects the data) according to
your criteria.
Another way is to use trigger or instead of trigger (instead of
trigger would be better).
My favorite of all of those is the stored procedure.
Adi
|||You could also consider a UNIQUE CONSTRAINT on the combination of a, b, and
c. What is the rule when c <> 1?
Sincerely,
Anthony Thomas

"Agoston Bejo" <gusz1@.freemail.hu> wrote in message
news:evpzFRF2EHA.3408@.tk2msftngp13.phx.gbl...
Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
Agoston

constraints on views

Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
AgostonCreate an indexed view with a unique index on (a,b).
--
David Portas
SQL Server MVP
--|||"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:570905D0-1D39-4CAF-995C-2DD91A2EC6B4@.microsoft.com...
> Create an indexed view with a unique index on (a,b).
Does this feature exists in SQL Server 7? Unfortunately I'm forced to work
with that, and I remember reading about this feature not being present in
SQL 7.
Thx,
Agoston
> --
> David Portas
> SQL Server MVP
> --
>|||You are correct, indexed views are not available in SQL 7. Probably the best
thing you can do in SQL 7 is to create a trigger that enforces this for you.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Agoston Bejo" <gusz1@.freemail.hu> wrote in message
news:evpzFRF2EHA.3408@.tk2msftngp13.phx.gbl...
> Hi.
> At first let me present the problem:
> T(a int, b int, c bit)
> I would like to see to it that (a,b) is unique where c = 1. The easiest
way
> to accomplish this would be creating a view like this:
> create view V as select a,b from T where c = 1
> And then putting a unique constraint on (a,b) in V.
> I am open to other solutions as well, of course.
> Thx,
> Agoston
>|||It is not clear from your message if you want to use regular view or
indexed view, but in any case you can only have constraint on indexed
view.
Another way that you can use is to work with stored procedure.
Instead of giving the users permissions to work directly with the
table, you can grant them execute permissions on a stored procedure
that inserts the data to the table (or rejects the data) according to
your criteria.
Another way is to use trigger or instead of trigger (instead of
trigger would be better).
My favorite of all of those is the stored procedure.
Adi|||You could also consider a UNIQUE CONSTRAINT on the combination of a, b, and
c. What is the rule when c <> 1?
Sincerely,
Anthony Thomas
"Agoston Bejo" <gusz1@.freemail.hu> wrote in message
news:evpzFRF2EHA.3408@.tk2msftngp13.phx.gbl...
Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
Agoston

constraints on views

Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
AgostonCreate an indexed view with a unique index on (a,b).
David Portas
SQL Server MVP
--|||"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:570905D0-1D39-4CAF-995C-2DD91A2EC6B4@.microsoft.com...
> Create an indexed view with a unique index on (a,b).
Does this feature exists in SQL Server 7? Unfortunately I'm forced to work
with that, and I remember reading about this feature not being present in
SQL 7.
Thx,
Agoston

> --
> David Portas
> SQL Server MVP
> --
>|||You are correct, indexed views are not available in SQL 7. Probably the best
thing you can do in SQL 7 is to create a trigger that enforces this for you.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Agoston Bejo" <gusz1@.freemail.hu> wrote in message
news:evpzFRF2EHA.3408@.tk2msftngp13.phx.gbl...
> Hi.
> At first let me present the problem:
> T(a int, b int, c bit)
> I would like to see to it that (a,b) is unique where c = 1. The easiest
way
> to accomplish this would be creating a view like this:
> create view V as select a,b from T where c = 1
> And then putting a unique constraint on (a,b) in V.
> I am open to other solutions as well, of course.
> Thx,
> Agoston
>|||It is not clear from your message if you want to use regular view or
indexed view, but in any case you can only have constraint on indexed
view.
Another way that you can use is to work with stored procedure.
Instead of giving the users permissions to work directly with the
table, you can grant them execute permissions on a stored procedure
that inserts the data to the table (or rejects the data) according to
your criteria.
Another way is to use trigger or instead of trigger (instead of
trigger would be better).
My favorite of all of those is the stored procedure.
Adi|||You could also consider a UNIQUE CONSTRAINT on the combination of a, b, and
c. What is the rule when c <> 1?
Sincerely,
Anthony Thomas
"Agoston Bejo" <gusz1@.freemail.hu> wrote in message
news:evpzFRF2EHA.3408@.tk2msftngp13.phx.gbl...
Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
Agoston