Help W/Disabling FK Constraints For Batch Operations

May 2, 2006

HI all,

I'm trying to have a SProc that will initialize a database for me. This db is in development (I'm primarily writing SSIS packages, atm), and I constantly need to truncate the tables, then re-add a dummy/unknown row (PK/Identity value = 1). Of course, I need triggers not to fire (got that part working), and FK constraints to be bypassed temporarily -- that's the problem.

Here's where I'm at:

----------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[_InitializeDB]
AS

SET NOCOUNT ON

DECLARE @name varchar(255)
DECLARE @sql nvarchar(255)

DECLARE tables CURSOR FOR SELECT [name] FROM [sysobjects] WHERE [type]='U' AND [name]<>'sysdiagrams'

OPEN tables
FETCH NEXT FROM tables INTO @name
WHILE @@FETCH_STATUS=0
BEGIN
SET @sql = 'ALTER TABLE ['+ @name + '] NOCHECK CONSTRAINT ALL'
EXEC sp_executeSQL @sql
SET @sql = 'DISABLE TRIGGER ALL ON [' + @name + ']'
EXEC sp_executeSQL @sql
SET @sql = 'TRUNCATE TABLE [' + @name + ']'
EXEC sp_executesql @sql
BEGIN TRY
SET @sql = 'INSERT INTO [' + @name + '] (Active) VALUES (0)'
EXEC sp_executeSQL @sql
END TRY
BEGIN CATCH
PRINT @sql + ':'
PRINT ERROR_MESSAGE()
END CATCH
SET @sql = 'ENABLE TRIGGER ALL ON [' + @name + ']'
EXEC sp_executeSQL @sql
SET @sql = 'ALTER TABLE ['+ @name + '] CHECK CONSTRAINT ALL'
EXEC sp_executeSQL @sql
FETCH NEXT FROM tables INTO @name
END

CLOSE tables
DEALLOCATE tables
----------------------------------------------------------------------------------

Running this Sproc produces (for the first ref'd table):

Msg 4712, Level 16, State 1, Line 1
Cannot truncate table 'Person' because it is being referenced by a FOREIGN KEY constraint.

View 4 Replies


ADVERTISEMENT

Batch Operations Of SQL Command.

Jun 6, 2007

Hi,Im trying to write a class that compiles a list of SQLCommands and then executes them all at once. Im trying to reduce the amount of calls to the database.Im also trying just to update the fields which have changed so I cannot use Stored Procedures as that would mean writing way too many stored procedures for every permutation on every table in my database.So Ive decided to build sql commands and then execute them all with one call to the database. When I print the commandtext property of the sqlcommand to the page whilst debugging It shows something like insert into XXX (f1,f2) values (@v1,@v2). Is there any way to see the final sql string, with the @v1 variables replaced by the actual values in the parameters I have added to the sql command?Im building the commands by creating a new sqlCommand. Then I set the commandtext to "insert into XXX (f1,f2) values (@v1,@v2)". Then I Add Parameters to the sqlCommand. My Parameters count is showing the correct value.I want to be sure now that when I go to send these commands to the database as part of one long string that it will work.Thanks,C 

View 3 Replies View Related

Disabling Foreign Key Constraints

Dec 22, 2000

I want to disable foreign key constraints en mass. Is there a way to do this?

I know that I can go into each table and navigate to the Relationship tab of Properties and uncheck the "Enforce relationship for INSERTs and UPDATEs" box, but I'd much prefer to automate this process with a query since there are 160+ tables and probably 200+ relationships to disable.

I figure that sysconstraints my be the ticket, but I will keep experimenting until I get the right solution. In the meantime, any insight to steer me in the right direction is appreciated.

View 1 Replies View Related

Any Script For Disabling All The Constraints On All The Tables In A Db?

Apr 21, 2004

Any script out there for disabling all the constraints on all the tables in a database?

Since there are more than 100 tables I need to import the data into, is there any generic script that I can use to disable all the constraints and triggers etc on all the tables?

Thanks,

View 4 Replies View Related

Checking For Unique Constraints During A Batch Update

Jan 28, 2004

hello .
i have a grid for a table that gets updated with recordset.updatebatch
for a multi-user application.

the problem is that some of the table fields have to be unique

now imagine the next situation.

user A opens the form
user B opens the form
user A writes '1000' in the unique field
user A saves the recordset with updatebatch

user B writes '1000' in the unique field
user B saves the recordset with updatebatch

now there will be two records with the field '1000' !

how can i avoid this ?
i cannot check for unique during the update event of the grid
because it should check during the time it is saving and not
when it is just entering data without having updated the recordset

thanks !

View 2 Replies View Related

Adding New Columns With Check Constraints Using Same Batch

Jul 11, 2006

I'm using a stored procedure to add fields to an existing table.

These fields must have check constraints and I need to use one T-SQL batch.

In Sql2000 Ok. In Sql2005, if table exists, I get error "invalid column xxxxx" in Add Constraint statement before new column creation.

the code is

Declare @Setup bit

Set @Setup = 1

if @Setup = 1 Begin

--Alter Table MyTable Add MyField Numeric(1, 0) Not Null Default 3

Exec mySp_Add_Column 'MyTable', 'MyField', 'Numeric (1, 0) Not Null', '3'

If IsNull(ObjectProperty(Object_Id('xCK_MyTable_MyField'), 'IsConstraint'), 0) = 0

Alter Table MyTable Add Constraint xCK_MyTable_MyField Check (MyField >= 1 And MyField <= 3)

End Else Begin

-- drop column

End

GO

If MyTable does not exist and, naturally, I add it before of check constraints (using another Sp which add tables) ok.

If I add FK to new fields, ok.

Now I have to split batch in two parts as workaround...

Can anyone tell me if this is a bug or a "fix" for previous versions?

Many thanks,

Giulio

View 7 Replies View Related

UGH! Failed To Enable Constraints. One Or More Rows Contain Values Violating Non-null, Unique, Or Foreign-key Constraints.

Jan 9, 2007

I know this is probably a flick of a switch but I cannot figure out which switch.  Setup is SQL Server / Stored Procedures / DAL / BLL(skipped for testing) / PL.  The stored procedure queries from only one table and two columns are ignored because they are being phased out.  I can run the stored procedure and preview the data in the DAL but when I create a page with an ODS linked to the DAL and a GridView I get this error.  I checked every column that does not allow nulls and they all have values.  I checked unique columns (ID is the only unique and is Identity=Yes in the table definition).  I checked foreign-key columns for values that are not in the foreign table and there are none.  Any ideas why do I get this? 
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

View 3 Replies View Related

Failed To Enable Constraints. One Or More Rows Contain Values Violating Non-null, Unique, Or Foreign-key Constraints.

Jan 17, 2008

Hi,
    I am getting the above error when trying to load a report into my Web Application, I have tracked the error down to one specific field in my database. Even though this field is a NVarChar field and is of size 30 it would seem that  there is an issue returning the value from the field. I can write it into the database no problems but when I try to get it out of the database it returns the above error.
e.g
MOB 401.908.804 - Fails
0401.907.324 - okay
8239 9082 (pager) - fails
Anyone got an idea on how to fix this????
Regards..
Peter.

View 7 Replies View Related

Passing Parameters To Batch File And Executing Batch File Loop

Aug 7, 2007

HELP,

I need to take a variable from a tabel in SQL Server pass to a Batch file and execute the batch file. Right now I can exec the batch file with XP_CMDSHELL but how can I pass the variable to the batch file and loop through all the variables.

Please help

Phil

View 4 Replies View Related

Set Operations (EXCEPT/EXCEPT ALL)

Jul 20, 2005

Hi all,I just start using SQL Server for my project. I have some questionsrelated to set operations. Suppose I have two tables, Table A andTable B, as following.TableA TableB======= =======--------------- ---------------| ID | DATA | | ID | DATA |--------------- ---------------| 1 | Val-01 | | 1 | Val-01 || 2 | Val-01 | | 2 | Val-02 || 3 | Val-02 | | 3 | Val-02 || 4 | Val-03 | | 4 | Val-03 || 5 | Val-04 | ---------------| 6 | Val-05 |---------------In DB2, I can write SQL statements as followingSQL 1:===========================SELECT DATA FROM TableAEXCEPTSELECT DATA FROM TableBAnd the result will beVal-04Val-05===========================SQL 2:===========================SELECT DATA FROM TableAEXCEPT ALLSELECT DATA FROM TableBAnd the result will beVal-01Val-04Val-05===========================1. How can I handle the EXCEPT (ALL) operator in SQL Server?2. Are there equivalent SQL queries for the above SQL queries?Thank youErwin Leonardi

View 4 Replies View Related

MS SQL DB Operations

Mar 31, 2008

I'm still a newbie with MS SQL DB. I was asked to perform some tasks within 3 days at maximum as follows:

1- Refine unique names from over than 80,000 students' names (Firstname, Middlename and Lastname) into a unique table so that we take all those name and translate them from local language to English through data entry employees (a dictionary).

2- Replace local names by English names into a new columns.

3- Creating a procedure that auto generates aliases based on Firstname, Middlename and Lastname as follows:

Assume the name John Edward Smith is found 5 times between 80,000 students, to create a unique ID do the following:

1- FirstnameLastnameint (JohnS).
2- FirstnameinLastname (JSmith).
3- FirstnameLastname (JohnSmith).
4- Firstnameint.Lastname (J.Smith).
5- Firstname.Middlenameint.Lastname (John.E.Smith).

Another precedure also needed:

We have 4 divisions at the establishment, needed to symoblize each division by a letter followed by ( - ) sign as follows:

1- If division = X , generate: x-ID
2- If division = Y, generate: y-ID
3- If divison = Z, generate: z-ID
4- If division =S, generate: s-ID



Can you please provide me with such a procedure to perform this in details?

Thank you

View 3 Replies View Related

Nonlogged Operations

Sep 28, 2000

Hello,

I would like to know if there is a way to disable logging within SQL. (SQL7)
I set all of the obvious options (select into/bulk copy; truncate on checkpoint...) -- and not using SQL Servers conditions set in books online.

Here is the situation:

We have a VB app that updates about 14million records on a monthly basis. The commands are INSERT, UPDATE.. (no select into OR write text) There is no way to use this app that I know using BCP, or bulk insert since we are updating and not simply importing?
So now when this process runs, first the Tempdb fills(problem 1). I shut down SQL and re-initalized the TEmpdb. The data "update" should take ~3 days. Initial run shows the Tempdb filling, then the thread halts. Basically, the application copies records from a user defined "staging" database into a second user database. The second db's transaction log is growing considerable (say 6GB and growing after only a day) (problem2). I am concerned that after resolving the Tempdb from filling (unrestricted size set, and I know Tempdb automatically truncates on checkpoint..) but then we still face the issue to the db that the data is updated will fill out of control!

Ideally, I would like to set a db option that disables logging during this UPDATE statement, in other words operate with no integrety. We backup before so a restore should take care of things in the event. I think this will also aid in performance.

Thoughts on update nonlogged operations if any?

Thanks in advance.
Jason

View 2 Replies View Related

Row By Row Operations In Sqlserver

Sep 15, 2006

hello,

I need to push data from a temporary table into a master table in sql server database(Both tables are in the same database).

I need to follow these conditions.
tables used:
1. temporary table: Temp
2. master table: Master

for every record or row in Temp
check if exists(Temp.field1)in Master.Field1 then
update Master with this row.
else Insert into Master this row.

I performed a research through the net, and found various suggestions. like usage of cursors, usage of while loops etc.
I have to use nearly 50,000 to 60, 000 rows minimum or even more.
Time complexity is also to be considered

I request all who visit this thread to place any possible solutions/suggestions how shall i make this task.

I thank all in advance

View 4 Replies View Related

File Operations

Apr 17, 2007

I need to know, how to rename a file, how to delete a file. how to create a file, all programmatically in Vista.



Thanks in advance,



Frank

View 1 Replies View Related

Datetime-Based Operations

Apr 26, 2007

I'm new to SQL Server and relatively new to database design and I have a specific problem I'm trying to resolve.  I have a collection of records in a table (let's call them 'tasks') which represent some list of things that needs to be completed.  Each task has an associated datetime on which this action is to commence, and my applications is responsible for executing these tasks.  My first instinct is to regularly poll the 'tasks' table to determine if there are any tasks which have not been processed and are past their schedule start datetime.   But, I'm wondering if there is some sort of database feature that would  recognize that a task's starttime has arrived, and could somehow communicate this to my application without my application having to constantly poll the database.  Thanks.

View 5 Replies View Related

Operations Through Stored Procedures

Nov 20, 2007

i write a following stored procedure
create proc prc_BUSINESS_MASTER(@chByMode   Char(1),  @intLIST_ID int=null,@intLISTBUSINESSID int=null,@dtmDATE datetime=null,@dtmEXPDATE datetime=null,@vchSTATUS varchar(10)=null,@vchOFFICE varchar(100)=null,@numCITY numeric =null,@numCOUNTY numeric=null,@numSTATE numeric=null,@numCOUNTRY  numeric=null,@vchSICCODE varchar(50)=null,@numASKINGPRICE numeric =null,@numDOWNPRICE numeric=null,@bitOWNERFINANCE bit=null,@numOWNERFINANCE numeric=null,@numADJ_NETAMOUNT numeric=null,@numSALESAMOUNT numeric=null,@dtmYOE datetime=null,@dtmYRSOWNED datetime=null,@bitBITISACTIVE bit=null,@vchCREATEDBY varchar(50)=null,@dtmCREATEDDATE datetime=null,@vchUPDATEDBY varchar(50)=null,@dtmUPDATEDDATE datetime=null
)
as
set nocount ondeclare @byIntErrDescOut intdeclare @interrno intdeclare @intdupchk intbegin
IF @chByMode NOT IN ('I','U')      BEGIN        SET @byIntErrDescOut = 1        Return -1       END   SET @byIntErrDescOut = 0   /* *************** Insertion Area *************** */ 
 
IF @chByMode = 'I' BEGIN       
IF  @vchSTATUS IS NULL OR @vchSTATUS = ''          BEGIN     SET @byIntErrDescOut = 1     Return -1               END
/*****  Duplicate  checking   ****/ 
 
SELECT @intDupChk = COUNT(1) FROM BUSINESSMASTER WHERE vchLIST_STATUS=@vchSTATUS And vchLIST_OFFICE=@vchOFFICE    IF  @intDupChk <> 0         BEGIN    SET @byintErrDescOut = 5    Return -1             END 
 
insert into BUSINESSMASTER(
intLIST_ID,dtmLIST_DATE,dtmLIST_EXPDATE,vchLIST_STATUS,vchLIST_OFFICE,numLIST_CITY,numLIST_COUNTY,numLIST_STATE,numLIST_COUNTRY,vchLIST_SICCODE,numLIST_ASKINGPRICE,numLIST_DOWNPRICE,bitLIST_OWNERFINANCE,numLIST_OWNERFINACE,numLIST_ADJ_NETAMOUNT,numLIST_SALESAMOUNT,dtmLIST_YOE,dtmLIST_YRSOWNED,bitBITISACTIVE,vchCREATEDBY,dtmCREATEDDATE,vchUPDATEDBY,dtmUPDATEDDATE
)values(@intLIST_ID,@dtmDATE,@dtmEXPDATE,@vchSTATUS,@vchOFFICE,@numCITY,@numCOUNTY,@numSTATE,@numCOUNTRY,@vchSICCODE,@numASKINGPRICE,@numDOWNPRICE,@numOWNERFINANCE,@bitOWNERFINANCE,@numADJ_NETAMOUNT,@numSALESAMOUNT,@dtmYOE,@dtmYRSOWNED,@bitBITISACTIVE,@vchCREATEDBY,@dtmCREATEDDATE,@vchUPDATEDBY,@dtmUPDATEDDATE
)
SET @intErrNo = @@Error          IF (@intErrNo <> 0)            BEGIN     SET @byIntErrDescOut = 2     Return -1            END
/*Insertion Area End*/
 
/*-------Updation----------*/
/* IF @chbyMode = 'U'        BEGIN         --IF @intBuyerId  IS NULL        BEGIN     SET @byIntErrDescOut = 1     Return -1            END 
*/
IF (EXISTS (SELECT * FROM  BUSINESSMASTER    WHERE   intLISTBUSINESSID  = @intLISTBUSINESSID ))  BEGIN 
 
    /*****  Duplicate  checking   ****/ 
SELECT @intDupChk = COUNT(1) FROM BUSINESSMASTER      WHERE intLISTBUSINESSID  = @intLISTBUSINESSID and vchLIST_STATUS=@vchSTATUS     IF  @intDupChk <> 0         BEGIN    SET @byintErrDescOut = 5    Return -1             END 
 
     UPDATE  BUSINESSMASTER         SET   intLIST_ID=@intLIST_ID,dtmLIST_DATE=@dtmDATE,dtmLIST_EXPDATE=@dtmEXPDATE, vchLIST_STATUS=@vchSTATUS,vchLIST_OFFICE=@vchOFFICE,numLIST_CITY=@numCITY,numLIST_COUNTY=@numCOUNTY, numLIST_STATE=@numSTATE,numLIST_COUNTRY=@numCOUNTRY,vchLIST_SICCODE=@vchSICCODE,numLIST_ASKINGPRICE=@numASKINGPRICE,numLIST_DOWNPRICE=@numDOWNPRICE,bitLIST_OWNERFINANCE=@bitOWNERFINANCE,numLIST_OWNERFINACE=@numOWNERFINANCE,numLIST_ADJ_NETAMOUNT=@numADJ_NETAMOUNT,numLIST_SALESAMOUNT=@numSALESAMOUNT,dtmLIST_YOE=@dtmYOE,dtmLIST_YRSOWNED=@dtmYRSOWNED,bitBITISACTIVE=@bitBITISACTIVE,vchCREATEDBY=@vchCREATEDBY,dtmCREATEDDATE=@dtmCREATEDDATE,vchUPDATEDBY=@vchUPDATEDBY,dtmUPDATEDDATE=@dtmUPDATEDDATEWHERE intLISTBUSINESSID = @intLISTBUSINESSID            -- AND WhenUpdated = @ptmsUpdated             SET @intErrNo = @@Error             IF (@intErrNo <> 0)             BEGIN      SET @byIntErrDescOut = 4      Return -1             END       END    ELSE     BEGIN     SET @byIntErrDescOut = 4     Return -1          END      END    End
How can i check this procedure by performing insert ,update operations?
ie., how can i passing and updating informations through stored procedures?
Explain me in detail....

View 2 Replies View Related

Status On Set Based Operations?

Aug 26, 2004

Every time I mention cursors, I hear a lot of people pointing out how you shouldn't use cursors and how set based operations are much faster.

However, procedural code offers the big advantage that I can embed status/progress type commands into a cursor loop and get accurate data on progress and ETA.

If I execute a single huge UPDATE/INSERT, I am at the whim and mercy of SQL Server. Seemingly simple statements often run for 50 hours+ and I have no clue how far along it is or anything remotely close to an ETA. Often, that is absolutely inacceptable to have mission criticial hardware to be churning through a process for DAYS without the slightest idea if it is actually making progress or not.

Is there any way to get progress/status on such an UPDATE/INSERT command?

View 11 Replies View Related

Cross Database Operations

May 6, 2008

Hi,
I'm trying to get data from several databses of different kinds (Sql Server and Oracle) and from different servers - is that possible ?
If not - is there any way to copy some data from one database to another - like tables and their content (or partial content) ?

I tried to use "select name from <database name>..sysobjects where xtype = 'U'" but I get security error.

thanks,
Naama

View 2 Replies View Related

Thoughts On Asynchronous Operations With SLQ Ce

Jan 3, 2007

I noticed that the current SLQCe driver does not offer support for the APM(Asynchronous Programming Model). Are there any plans to do this in the future? In light of the lack of APM functionality doe anyone have any ideas or thoughts on how async operations could be done, or if they are even needed in the context of applications that use SQL Ce

View 4 Replies View Related

Trigger - Disabling

May 18, 2001

I need to disable a trigger for a week w/o droping it. Is there a way in sql ?

Thanks and nice week-end.

Ivan

View 2 Replies View Related

Job Is Disabling Every Night

Apr 12, 2002

Please help if you can! I have setup a job that runs every day on an hourly basis. Every morning I find that it's been disabled. The funny thing is is that the schedule is disabled, but the job is not (you see 'Enabled' in the jobs list in EM, but when you view the schedules tab, it's disabled.) Also, it runs a several times before becoming disabled.

TIA,

Colleen

View 2 Replies View Related

Disabling Replication

Jan 9, 2003

I have a server that was being used for logshipping and had
replication set up at some point as well. One of the databases got out
of sync in the logshipping process so I removed logshipping and was
going to reinitialize the database and set up the logshipping again.
The database is in read only mode and when I try to take it out of
read only I get the following message:

Error 5063: Database 'XXXXXXXX' is in warm standby. A warm stanby
database is read-only. ALTER DATABASE statment failed. sp_dboption
command failed.

I have tried to disable replication on the server but get the
following error message:

SQL Server Enterprise Manager could not disable 'SRVXXXX' as a
publisher.
Error 3906: Could not run BEGIN TRANSACTION in database 'XXXXXXX'
because the database is read only.

So my problem is that I can't take the database out of read-only mode
because of replication and I can't disable replication because the
database is in read-only mode.

Has anyone come across this before and how should I resolve it? I
tried dropping the database as well and that didn't work either.

Any ideas or help would be greatly appreciated.

Thanks in advance,

Brad

View 1 Replies View Related

Disabling The Trigger

Mar 25, 2003

Hi,

I have a update trigger on a table. Can I disable this trigger for duration of a job which updates this table.

Thanks in advance ...j

View 1 Replies View Related

Disabling Triggers

Feb 15, 2001

Is there a way to disable a trigger when performing a transaction besides dropping and recreating the trigger? I am trying to perform an insert on a table, and this keeps firing a trigger that I want to disable.

Any help is appreciated.

View 3 Replies View Related

Disabling Distribution DB

May 28, 2008

I have accidentally registered an existing database as a distribution database, which made it a system database.
the data itself is safe and sound, but I want to undo the whole thing.

How can I do this?

View 1 Replies View Related

Disabling Job Using VBScript

Jun 6, 2008

I have an SQL job that runs a .vbs script. It has the following code:

Cmd2.ActiveConnection = Conn2
Cmd2.CommandText = "USE msdb EXEC sp_update_job @job_name = 'Email Download',@enabled = 0"
Cmd2.CommandType = 1
Cmd2.Execute()

It's not disabling the job. If I execute in Query Analyzer, it works. I'm thinking it might be a permissions issue. Any suggestions?

TIA

View 10 Replies View Related

Disabling Primary Key

Jul 20, 2005

Hii have a table with primary key defined on col1 and col2. now i want tohave col3 also included in primary key. when i alter the table it givesme error for duplicate rows. there is an option for 'with nocheck' butit only works with check or foreign key constraint. is there any optionin sql server like in oracle 'no validate' which doesnt validate theexisting data and force the data validation from new records.thanxFarid*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 5 Replies View Related

Disabling All Logins

Dec 4, 2007

Hi all,


1) Can anybody provide me the script for DISABLING all the jobs in the server and vice versa (i.e.) for enabling also.


2) Script for DISABLING LOGINS and script for ENABLING all Logins.

Its Sql Server 2005


Thanks... Any Help Greatly appreciated.

View 6 Replies View Related

Queue Not Disabling

Oct 11, 2006

HI There

My activated proc is rolling back the transaction and putting the message abck on the queue infinately ?

Normally it disabled the queue after a few rollbacks, i can see in the sql log that it just keeps rolling back and re-activating thousands of times.

It only stops when i disable activation on the queue.

WHy is the queue not disabling ?

Thanx

View 3 Replies View Related

Disabling The TransactionLog

Sep 20, 2006

I have an SSIS task that transforms 70 million rows of data nightly.

The data is dumped and imported fresh every day.

Obviously I don't want my production Transaction Log getting cluttered up with 70 million rows of transaction logs daily.

Is there any way to avoid logging to the transaction log with an SSIS task?

View 5 Replies View Related

Constraint Disabling

Dec 20, 2006

Hi,

Is there any way to disable/enable constraints on the table?

Command "ALTER TABLE table_name {CHECK|NOCHECK} CONSTRAINT ALL" produces error.

View 8 Replies View Related

SQLCMD Batch File With Script In Batch File

Dec 5, 2006

I am using the following batch file to execute a script that creates a db and all its objects in the local sql express:

sqlcmd -S (local)SQLExpress -i C:CreateDB.sql

This works fine, but I'm wondering if there's an easy way to put the script in the batch file, so users don't have to worry about putting the script in the C drive. I tried getting rid of the i parameter and pasting the script from the sql file into the batch file, but it didn't work.

Thanks,

Dave

View 1 Replies View Related

Make Math Operations With DateTime

Sep 23, 2007

hi,
how can i make mathematical operations with the DateTime format from thw Sql? -- this is the format 9/6/2007 11:09:00 PM --
how can i substract 30 days from that date and know the resulting one?
if i have two dates, how can i know what number of hours and minutes are between them (if they are fewer than 24), or what number of days and hours and minutes are (if the difference is grater than 24 hours)
please help me, thanks

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved