Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Wednesday, March 28, 2012

Manage Data

Hello,
I am working on an ASP.NET web site using an SQL database.
Is there a way to Insert/Delete and Update data in the database
without creating all the forms in ASP.NET?
Since I am the only person to work with the database it would be
easier for me than creating all ASP.NET forms.
Thanks,
MiguelHi
Hmm, so get in SSMS and/or Query Builder and issue DML there.
"shapper" <mdmoura@.gmail.com> wrote in message
news:d128e2f4-c3fc-4873-b491-1ccc1ee40928@.t54g2000hsg.googlegroups.com...
> Hello,
> I am working on an ASP.NET web site using an SQL database.
> Is there a way to Insert/Delete and Update data in the database
> without creating all the forms in ASP.NET?
> Since I am the only person to work with the database it would be
> easier for me than creating all ASP.NET forms.
> Thanks,
> Miguel

Manage Data

Hello,
I am working on an ASP.NET web site using an SQL database.
Is there a way to Insert/Delete and Update data in the database
without creating all the forms in ASP.NET?
Since I am the only person to work with the database it would be
easier for me than creating all ASP.NET forms.
Thanks,
Miguel
Hi
Hmm, so get in SSMS and/or Query Builder and issue DML there.
"shapper" <mdmoura@.gmail.com> wrote in message
news:d128e2f4-c3fc-4873-b491-1ccc1ee40928@.t54g2000hsg.googlegroups.com...
> Hello,
> I am working on an ASP.NET web site using an SQL database.
> Is there a way to Insert/Delete and Update data in the database
> without creating all the forms in ASP.NET?
> Since I am the only person to work with the database it would be
> easier for me than creating all ASP.NET forms.
> Thanks,
> Miguel

Manage cluster resources via Visual Basic

Hello,
is it possible to manage cluster resources with a script language like
Visual Basic?
I want to update the cluster applications with an automatic
installation process. Therefore I must stop the corresponding cluster
resource (take offline), update the application and restart the
cluster resource (bring online).
Knows anyone a way to do this within a Visual Basic program?
Thanks
Widmann
Yes, it is very possible. Do I know how to do it? Heck no. I am not a
programmer in any sense. Check msdn.microsoft.com or "goggle
site:msdn.microsoft.com" cluster programming. Or something like that using
programmer speak
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Friedbert Widmann" <WidiHEL@.gmx.de> wrote in message
news:1acb6845.0411180650.2a2d88e6@.posting.google.c om...
> Hello,
> is it possible to manage cluster resources with a script language like
> Visual Basic?
> I want to update the cluster applications with an automatic
> installation process. Therefore I must stop the corresponding cluster
> resource (take offline), update the application and restart the
> cluster resource (bring online).
> Knows anyone a way to do this within a Visual Basic program?
> Thanks
> Widmann
|||This might be a good place to start:
http://msdn.microsoft.com/library/en...start_page.asp
Regards,
John
"Rodney R. Fournier [MVP]" <rod@.die.spam.die.nw-america.com> wrote in
message news:OWHUHbYzEHA.1196@.TK2MSFTNGP15.phx.gbl...
> Yes, it is very possible. Do I know how to do it? Heck no. I am not a
> programmer in any sense. Check msdn.microsoft.com or "goggle
> site:msdn.microsoft.com" cluster programming. Or something like that using
> programmer speak
> Cheers,
> Rod
> MVP - Windows Server - Clustering
> http://www.nw-america.com - Clustering
> http://msmvps.com/clustering - Blog
> "Friedbert Widmann" <WidiHEL@.gmx.de> wrote in message
> news:1acb6845.0411180650.2a2d88e6@.posting.google.c om...
>
|||The easiest way is to us the command-line tool 'Cluster.exe'. It works very
well from a script. See Windows help for details.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Friedbert Widmann" <WidiHEL@.gmx.de> wrote in message
news:1acb6845.0411180650.2a2d88e6@.posting.google.c om...
> Hello,
> is it possible to manage cluster resources with a script language like
> Visual Basic?
> I want to update the cluster applications with an automatic
> installation process. Therefore I must stop the corresponding cluster
> resource (take offline), update the application and restart the
> cluster resource (bring online).
> Knows anyone a way to do this within a Visual Basic program?
> Thanks
> Widmann
|||use WMI...but carefull
rgds
Sinisa
"Geoff N. Hiten" wrote:

> The easiest way is to us the command-line tool 'Cluster.exe'. It works very
> well from a script. See Windows help for details.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Friedbert Widmann" <WidiHEL@.gmx.de> wrote in message
> news:1acb6845.0411180650.2a2d88e6@.posting.google.c om...
>
>

Monday, March 26, 2012

making sense of deadlock

Example,
1) Two transactions, A and B have a Shared Lock on a resource
2) Both intend to update the resource
3) Transaction A comes in an places an Update lock on the resource
4) Transaction A then tries to do a Exclusive Lock on the resource.
Shouldnt step 4 cause a deadlock since Transaction B is waiting on A to
release its locks, while Transaction A is waiting on B to release the Shared
lock before it can place the Exclusive Lock on the same resource?
Im a little ... thanks for any insight.
GNo, it won't cause a deadlock. Obtaining the update lock ensures that only
Transaction A can transition to an exclusive lock on the resource in order t
o
perform the update. Obtaining the update lock ensures that Transaction A
doesn't have to wait for Transaction B to release its shared lock before it
can transition to an exclusive lock to perform the modification.
READ: "Understanding Locking in SQL Server" in books online.
"Girish" wrote:

> Example,
> 1) Two transactions, A and B have a Shared Lock on a resource
> 2) Both intend to update the resource
> 3) Transaction A comes in an places an Update lock on the resource
> 4) Transaction A then tries to do a Exclusive Lock on the resource.
> Shouldnt step 4 cause a deadlock since Transaction B is waiting on A to
> release its locks, while Transaction A is waiting on B to release the Shar
ed
> lock before it can place the Exclusive Lock on the same resource?
> Im a little ... thanks for any insight.
> G
>
>

Friday, March 23, 2012

Making a stored procedure run on its own periodically.

Hi,
I have a requirement to update a table in SQL Server through a stored
procedure,
the stored procedure should run periodically, say once in a month, and
update the table.I should not use any external programs to call the
stored procedure, is there any other way to do it without using an
external programs.
Thanks in advance,
RajanSchedule a job that calls the stored procedure:

http://msdn.microsoft.com/library/e...tomate_4v1v.asp

--
David Portas
----
Please reply only to the newsgroup
--|||Thank you so much.

"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message news:<x8GdnWECNf3zSFSiRVn-gw@.giganews.com>...
> Schedule a job that calls the stored procedure:
> http://msdn.microsoft.com/library/e...tomate_4v1v.asp

Making a SQL Update Query run once

I have a datagrid in my file along with an Update Query.
My Update Query basically adds the numerical values in two columnstogether when the page is loaded. This means whenever the page isRefreshed the Update query is fired.
This is my Update Query (which is in an Stored Procedure):
UPDATE Rental
SET TotalFee = ExtraFee + TotalFee
WHERE DaysOverdue >= 0
I have declared my query in the 'Page_Load' part of the coding, becauseI want the query to run automatically. Not manually by a button.
My main question is that how can I get the query to run only once a day, no matter how many times the page is loaded.
While I wouldn't recommend putting an update query in your page_Load,you can test for a postback before running the query by querying thePage.IsPostBack property: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassIsPostBackTopic.asp
|||The query will run whenever your page runs but you can force SQL Server to keep the compiled version of the query in the procedure cache by using the auto start option with sp_procoption system stored proc in the Master database. Run a search for sp_procotion in SQL Server BOL (books online). Hope this helps.|||

I would not have the query run by any ASP.NET page. What happens if no one visits the page in question some day? What happens when the site restarts?

Use DTS on the SQL Server and schedule a job to run once a day.

|||I think Doug is offering the best advice. It looks like you arecalculating late fees so you'd definitely want to run it every day.
If it doesn't matter whether or not it runs every day, and you simplywant it to run no more than once a day, I would add a datetime columnflagging the date on which it was last run. Then you could changeyour query like this:
DECLARE @.Today datetime
SELECT @.Today = GETDATE()
UPDATE Rental
SET TotalFee = ExtraFee + TotalFee,
DateFlagged = @.Today
WHERE DaysOverdue >= 0 AND
DateFlagged < CONVERT(char(8),@.Today,112)
Another option is to calculate the TotalFee on the fly,something like this, rather than updating it every day. Thiswould be safer and not dependent upon a process running every day (andI am guessing that DaysOverDue is also being populated by a process...):
SELECT TotalFee = TotalFee + (ExtraFee * DaysOverDue)
FROM Rental

|||Thanks for all your input.
But I think the best solution to my problem would be using this query:
DECLARE @.Today datetime
SELECT @.Today = GETDATE()
UPDATE Rental
SET TotalFee = ExtraFee + TotalFee,
DateFlagged = @.Today
WHERE DaysOverdue >= 0 AND
DateFlagged < CONVERT(char(8),@.Today,112)

But for some reason I cannot seem to get it to work. I have made anextra column in my table called 'DateFlagged'. I have tried to make itwork by creating this column data type as Date and char. But either wayit is not calculating the Total Fee.
I would appreciate any more info to make this query work.

|||DateFlagged should definitely be a datetime data type. Thiscolumn will initially contain a NULL if you do not set a default valuefor it, so any comparison against a value will return aFALSE. Therefore you'll need to check it for a NULL valueas well.
See if this helps:
WHERE DaysOverdue >= 0 AND
(DateFlagged < CONVERT(char(8),@.Today,112) OR DateFlagged IS NULL)

|||Yep! You solved my problem.
Thanks alot for all your help!

Monday, March 12, 2012

Make a copy of SQL DB and update/change stored procedures

Can I make a copy of my development database DEV on same SQL SERVER machine, rename it to TEST and stored procedures to be updated automatically for statements like

UPDATE [DEV].[dbo].[Company]

SET [company_name]= @.company_name

to become

UPDATE [TEST].[dbo].[Company]

SET [company_name]= @.company_name

in order not to edit each individual stored procedure for updating it ?

Hi Chris,

You would have to use SQL Query Analyzer.

USE test
GO

CREATE PROCREDURE p_company_update
@.company_id INT,
@.company_name VARCHAR(64)
AS
SET NOCOUNT ON
UPDATE company
SET company_name = @.company_name
WHERE company_id = @.company_id
GO

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/

|||Thanks for your message.

Friday, March 9, 2012

Major difference.

What are the major difference b/w rebuilding indexes and update statistics
thanks
Statistics: http://www.mssqlcity.com/Articles/Adm/IndexStat70.htm
Preprocessing --> Statistics
Query --> Indexes to retrieves the result on the data pages
Simple example: You have serveral books whch contain from 1 to 1000000
words, If you are searching a word in the "one word book" you have to know
that it is not necessary to use the book index. Thats because you got your
own statistics in your mind to know "Thats a quite thin book, i rather
search side by side" or that book doesnt contain an index, so ill have to
run through the pages to find the word.
Thatl just a plain example i suggest you to read articles of one of the
best authors of indexes --> Kalen Delaney
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"Joh" <joh@.mailcity.com> schrieb im Newsbeitrag
news:Ol6EAKRRFHA.3988@.tk2msftngp13.phx.gbl...
> What are the major difference b/w rebuilding indexes and update statistics
> thanks
>