sql-server

how to implement undo operation in datagridview

Hi, I have created one application in c#.net.Using this application we can update datagridview,now i need to implement undo in it plz give me some ideas. private void button29_Click(object sender, EventArgs e) { Datatable dt; dt.RejectChanges(); } using above code i can do undo before updating. but i...

Is there any ORM tool for sql server 7.0?

I have a sql server 7.0 database and I will implement a web service above it. How do I access the data without writing any sql query? ...

Sending Mail Using SQL Server 2000

Duplicate of: http://stackoverflow.com/questions/1620508/automated-smtp-not-mapi-emails-using-sql-server-job-scheduler I want to send mail using Stored Procedure using SQL Server 2000 using windows smtp component. I don't want third party component.My SMTP server name ='mail.met.net'.how to send mail using the sql server 2000? CREATE...

Which right grants user a right to grant another right to himself in SQL 2008?

I need to grant a db_datawriter before executing SqlBulkCopy and remove it after: try { "EXEC [db_mod].[sys].[sp_addrolemember] N'db_datawriter', N'my_user'" // via SqlCommand bulk.WriteToServer(table); } finally { "EXEC [db_mod].[sys].[sp_droprolemember] N'db_datawriter', N'my_user'" // via another SqlCommand } but I'm getti...

SQL Server Where Clauses

Hi, When running a select query (on SQL SERVER 2000+) with multiple where statements such as SELECT * FROM TABLE1 WHERE TableId = @TableId AND Column1 = @Column1 AND Column2 = @Column2 AND Column3 = @Column3 etc. ...does the query calculate each and every one of the where clauses even if ...

Hide relationship from a SQL Server database diagram

I am using SQL Server 2005 database with SQL Server Management Studio. Is there a way to hide a relationship between two tables in the diagram without actually deleting the relationship from the database? Any help will be most appreciated. ...

How to find the days compare with date?

Using SQL Server 2005 Table1 Date 20090501 20090502 20090503 20090504 20090505 ..., I want to find the day compare with date, then i want to skip the date where the day = sunday. Expected Output 20090501 20090502 20090504 20090505 .., So 20090503 is skipped, because it is Sunday. How to make a query? ...

Splitting out one table to a separate server

Hi all, Background, I am running MS SQL Server 2005. What do you guys think about this. I have an analytics process whereby a stored procedure is fired off on every page of my website and the results logged into my analytics table. Given that I have thousands of users on my site daily, this a very frequent albeit "light" overhead to ...

Slow (to none) performance on SQL 2005 after attaching SQL 2000 database

Issue: Using the detach/attach SQL database from a SQL 2000 SP4 instance to a much beefier SQL 2005 SP2 server. Run reindex, reorganize and update statistics a couple of times, but without any success. Queries on SQL 2000 took about 1-2 sec. to complete, now the same queries take 2-3 min on the SQL 2005 (and even 2008 - tested it there...

Saving Inserted and Deleted tables into variables for use in .NET code (via sp_oamethod) [SQL Server 2000]

I am trying to create a SQL Trigger in SQL Server that will somehow serialize the Inserted and Deleted tables for use in .NET code (via sp_oamethod). I would like this to be generic enough to use for any table. My first attempt involved using "for xml" to serialize it into XML, and pass it to .NET code. However, I have been unable to ...

Unique id property value to identify an Access database instance

I have an access 'application' (.adp file), when it opens i have it update an admin database with the username and time open. When it closes it updates the admin database with username time closed - these are sperate records in the events table so it looks like username,dbaction,time bob,open,13:00 gareth,open,13:05 bob,close,14:00 If...

Error on Save a changed row if the change was in a field of type 'Memo'

Hi there, We have a Access-db with linked (odbc) tables on an sql-server. Some times there is a rare problem with one column of a particular row: no more changes in the field of type memo are possible. Changes in other columns of this particular rows are saved as normal. The error-msg goes something like: annother application has chang...

Configuring a SQL Server (2008) Monitor Server

After having a period of logshipping failures going unnoticed (due to a stopped SQL Agent on the secondary server) I'm looking at configuring some monitoring. Having seen the ability to specify a "Monitor Server instance" on the SQL Server 2008 log shipping setup and the relavant MSDN docs (http://msdn.microsoft.com/en-us/library/bb5107...

"Maximum allowed trigger depth" in SQL Server?

I know about "Allow Triggers to Fire Others" server setting that allows the action taken by a trigger to fire another trigger (or not), and as I understand it, my only options are True (allow trigger to fire other triggers, which may lead to unending recursion) or False (actions taken by triggers will not fire any other triggers, which m...

How to query for rows along with their xml representation?

I need something like select * from tb_listings for xml auto But I need every row to be separate, and not one big xml document. I have tried something like the following: select id, (select * from tb_listings a where a.id=id for xml auto) as xmldata from tb_listings Expected output is like: id xmldata ------------------...

SQL Server to PostgreSQL - Migration and design concerns

Currently migrating from SQL Server to PostgreSQL and attempting to improve a couple of key areas on the way: I have an Articles table: CREATE TABLE [dbo].[Articles]( [server_ref] [int] NOT NULL, [article_ref] [int] NOT NULL, [article_title] [varchar](400) NOT NULL, [category_ref] [int] NOT NULL, [size] [bigint] NOT...

Performance implication on nvarchar(4000)?

I have a column that is declared as nvarchar(4000) and 4000 is SQL Server's limit on the length of nvarchar. it would not be used as a key to sort rows. Are there any implication that i should be aware of before setting the length of the nvarchar field to 4000? Update I'm storing an XML, an XML Serialized Object to be exact. I know t...

T-SQL Parameters

I have the following table in SQL Server 2000: TABLE_NAME | COLUMN_NAME | TYPE_NAME | PRECISION | LENGTH | SCALE | test TestID int 10 4 0 test TestDecimal decimal 18 ...

Select latest records by datetime field

How could i select the latest records by datetime of an SQL Server? Here is the pseudo-code... SELECT Records FROM MyTable WHERE current time >= (CurrentTime - 2 minutes) Supposing the current Time is 10:25:39 pm 26/10/2009 10:25:39 pm 26/10/2009 10:25:00 pm 26/10/2009 10:24:53 pm 26/10/2009 10:24:19 pm 26/10/2009 10:23:58 pm 2...

Getting deadlocks in sqlserver

I am getting deadlocks occasionally in sql server. I created a function for locking non database operations (credit card processing) so duplicates cannot happen. My functions are as follows (sorry for the tcl, but the sql is clear enough). Can anyone see why a deadlock happens occasionally????? proc ims_syn_lock_object { db object {time...