Isnull Func In Coditional Split Tran

Jul 25, 2006

All,

I need to use ISNULL function in a Conditional split transformation. Data will be split based on the ISNULL function. ISNULL( col) can get all the null records, How to get the not null records? ISNULL(col) = €śfalse€? doesn€™t work.

Thanks in Advance

View 6 Replies


ADVERTISEMENT

Logistics Of Begin Tran And Rollback Tran

Dec 19, 2007

I am running an Execute SQL task that does a Begin Tran, then the next task in the sequence is a data task which imports a XML file into two tables. If i doo a Rollback Tran only one of the two tables is rolled back.

Is it possible to have both tables rolled back from one Begin tran command or do i need to split the datatasl into two and treat each import as a seperate issue ?

The connection is set to retainsameconnection

thanks

View 7 Replies View Related

Begin Tran, Commit Tran

Oct 8, 2007



Hi,

I want to rollback my t-sql if it encounters an error. I wrote this code:

begin tran mytrans;
insert into table1 values (1, 'test');
insert into table1 values (1, 'jsaureouwrolsjflseorwurw'); -- it will encounter error here since max value to be inputted is 10
commit tran mytrans;

I forced my insert to have an error by putting a value that exceeds the data size. However, I didn't do any rollback. Anything i missed out?

cherriesh

View 4 Replies View Related

SUM Func Wont Work HELP!~!~!

Jul 3, 1999

hello,..
please take a look and tell me what's wrong.

*** declare @myfine money
select @myfine=sum(
select fp.total_fine from final_payment fp,inserted i
where fp.member_no=i.member_no and fp.return_complete=0)***
i have final_payment table and everything.I'm creating this syntax in an insert trigger on my final_payment table. will @myfine value be the sum of total_fine where the conditions are true?please help

truly,
JC

View 1 Replies View Related

Scalar Func Questions

Jun 6, 2008

Hey Guys, I am creating a scalar function for the first time. I have googled, ck'd your FAQ's, looked 2 text books but cannot find the answer to my questions.
Is the IF statement used in the Scalar function like it is in the stored procedure. In other words does it have to return a Boolean? I want to perform a loop after I call the function, do I have to use a Cursor? Or can I code it like a VB function with a FOR/DO While? Also I can call this UDF from my Stored Proc, right?

Here is a quick synopsis of what I have been assigned to do:
--- Calculate Run Dates
--(start from Previous Saturday subtract 41 days
-- if the 41st day does not fall on a Saturday (day = 7)
-- keep subtracting days until Day=Saturday. Add 6 days to make
-- END date the following Friday)

Thanx,
Trudye

View 11 Replies View Related

Missing Leading Zero In Datapart Func If .....

Jun 9, 2003

I use the following code to fill the missing leading zero from datepart sys function. Is there another way simple to get the leading zero if month < 10 and/or if day < 9?
-D

--++++++++++++++++++++++++++++++++
declare @currentYYYYMMDD char(8)
declare @currentYYYY char(4), @currentMM varchar(2), @currentDD varchar(2)
select @currentYYYY = cast(datepart(yyyy, getdate()) as char(4))
select @currentMM = cast(datepart(mm, getdate()) as varchar(2))
select @currentDD = cast(datepart(dd, getdate()) as varchar(2))
print '@currentYYYY: ' + @currentYYYY + ' @currentMM:' + @currentMM + ' @currentDD:' + @currentDD

select @currentMM = case when @currentMM < 10 then '0' + @currentMM
else @currentMM end
select @currentDD = case when @currentDD < 10 then '0' + @currentDD
else @currentDD end
print '@currentYYYY: ' + @currentYYYY + ' @currentMM:' + @currentMM + ' @currentDD:' + @currentDD
select @currentYYYYMMDD = @currentYYYY + @currentMM + @currentDD
print '@currentYYYYMMDD: ' + @currentYYYYMMDD

View 2 Replies View Related

Is It Possible To Use Dynamic Query Inside A Func

Jun 17, 2006

Hi to all,

Is It possible to use dynamic qyery inside a function in sql server.

For Example:

Create function fn_Test
Returns Table
As
Return sp_ExecuteSql 'SELECT * FROM EMP'

Like this.

With regards
Amjath

View 10 Replies View Related

User-Defined Func Syntax For Table Return

Oct 30, 2006

Hi all!

I'm trying to use a UDF that returns a table, but I'm not sure of the syntax to invoke it. I've found examples in BOL and on-line like the following:

SELECT * FROM dbo.fn_MyTableFunc( 123.09, 'MyID' )

But I need the input parameter to be obtained from another table. For a very simplistic example, I've got 4 tables (and yes, I know that I can get the results I want for this example without using a UDF, but humor me):

CREATE TABLE tUser (UserID int PRIMARY KEY, UserName varchar(50))
CREATE TABLE tAcctGroup (AcctGroupID int PRIMARY KEY, AcctGroupName varchar(50))
CREATE TABLE tAcct (AcctID int PRIMARY KEY, AcctGroupID int, AcctName varchar(50))
CREATE TABLE tMapUserToGroup (UserID int, AcctGroupID int)
GO

INSERT INTO tUser VALUES (111, 'Me')

INSERT INTO tAcctGroup VALUES (1, 'NY')
INSERT INTO tAcct VALUES (11, 1, 'New York City')
INSERT INTO tAcct VALUES (12, 1, 'Syracuse')

INSERT INTO tAcctGroup VALUES (2, 'GA')
INSERT INTO tAcct VALUES (21, 2, 'Atlanta')
INSERT INTO tAcct VALUES (22, 2, 'Savannah')
INSERT INTO tAcct VALUES (23, 2, 'Augusta')

INSERT INTO tAcctGroup VALUES (3, 'TX')
INSERT INTO tAcct VALUES (31, 3, 'Dallas')
INSERT INTO tAcct VALUES (32, 3, 'Houston')
INSERT INTO tAcct VALUES (33, 3, 'El Paso')
INSERT INTO tAcct VALUES (34, 3, 'San Antonio')

INSERT INTO tAcctGroup VALUES (4, 'CA')
INSERT INTO tAcct VALUES (41, 4, 'Los Angeles')
INSERT INTO tAcct VALUES (42, 4, 'San Francisco')

INSERT INTO tMapUserToGroup VALUES (111,2)
INSERT INTO tMapUserToGroup VALUES (111,4)
GO

CREATE FUNCTION dbo.ufnGetAcctList(@AcctGroupID int) RETURNS @tAcct table (AcctID int, AcctName varchar(50))
AS
BEGIN
INSERT INTO @tAcct
SELECT AcctID, AcctName FROM tAcct WHERE AcctGroupID = @AcctGroupID
RETURN
END
GO

I know that I can do:
SELECT * FROM TestDB.dbo.ufnGetAcctList(4)

But I want the equivalent of:
SELECT AcctID, AcctName FROM tAcct
WHERE AcctGroupID IN (SELECT AcctGroupID FROM tMapUserToGroup WHERE UserID = 111)

Which uses tMapUserToGroup to obtain the AcctGroupID to pass into the function. The results would be:
AcctID AcctName
-----------------------------
21 Atlanta
22 Savannah
23 Augusta
41 Los Angeles
42 San Francisco

Any thoughts?
Thanks in advance for your help.
Cat

View 7 Replies View Related

Code!func To Get Values In Header Only Works In IDE And Not Deployed Report (also Worked Ok In RS2000)

Jul 18, 2007

I have code



Function GetDealCount(reportItems)

return iif(IsNothing(reportItems!txtDetailCountRows.Value), 0, reportItems!txtDetailCountRows.Value)

End Function

Function GetSumNotionalAmount(reportItems)

return iif(IsNothing(reportItems!txtDealSumNotionalAmount.Value), 0, reportItems!txtDealSumNotionalAmount.Value)

End Function



That I am calling from a textboxes in the page header

= Code.GetDealCount(ReportItems) & " Deal(s)"

also

= Parameters!BaseCurrency.Value + " " + Format(Code.GetSumNotionalAmount(ReportItems),"N2").ToString().Replace(",","'")





When I preview the report in VS.NET I get values showing.

When I deploy the report I just get #Error showing.



Also this report used to work fine in RS2000



Does anyone know the cause of this issue?

View 6 Replies View Related

Tran Log

Apr 7, 2003

I have a transaction log that is over f gig in size....what can be done with this..and what are the pros and cons if I delete it...also how can I keep this from getting that big in the future. Thanks!

View 2 Replies View Related

Tran Log

Apr 20, 2001

To All:

On my SQL 6.5 box, I have a corrupt Tran log. I do not use my Tran log but now I am getting an 1105 error, that the log is full. I run Dump tran with no log but it does not work. I cannot perform any other function without getting the 1105 error. Now I tried to reboot and now it is hanging during reboot. It is hanging while checking the partition where the tran log resides. I went in to VGA Mode. Any ideas would be appreciated.

Many thanks,

Kelly

View 1 Replies View Related

Shortcut To Create @table Def From Table Func?

May 29, 2008

is there a way to create

"CREATE TABLE @table ( blah blah blah...."


from a table value function?

View 1 Replies View Related

Tran Log Growth

Aug 14, 2001

Does this seem right? We have our transaction logs set to "Truncate Log on Checkpoint" and they still grow over 1GB. Is it possible that one transaction (to a checkpoint) generates this much logged information? Will transaction log backups every 5-10 minutes help me out better or is this just a poorly written application?

Thanks!

View 4 Replies View Related

Contents Of The Tran Log

Oct 11, 1999

All,

Can everyone tell me how I can view the contents of a transaction log in SQL Server 7.

Many Thanks
Mathew hayward

View 3 Replies View Related

Tran Log Problems Please Help

Aug 13, 1999

Help. I have a database with high transaction rates. THe log is 300 mbs. No matter what i do I cannot get it below 64%. I have dumped and trucated the log yet it will not budge. Being friday and it being a time card application this is my heaviest transaction day. Please help

View 2 Replies View Related

Tran Log Space Used ????

Aug 22, 2002

Hi There,
How do I find the space used for the tran log of the db. sp_spaceused gives the space used for the complete database. but I need the space used for a tran log alone.
Thanks in advance.
pete

View 1 Replies View Related

Tran Logs And Backups

Oct 19, 2000

What is the advantage of taking frequent tran log backups (say every 30mins) as opposed to once a day? Say, I backup data and tran log once every night and I lost a table at 10:00am next day. Can't I recover the database to the point in time by restoring the previous night's backup and then applying the transaction log from previous night and then applying the transaction log (to the point int time) that you just dumped when the mishap was reported to you?

Thanks

View 2 Replies View Related

High CPU During Tran Log Dumps

Oct 22, 2002

We are experiencng high cpu utilization across all 4 cpu's at the top of the hour when our transaction log dump job runs. Has anyone observed this bahavior before? Is there anything we can do to mitigate this? Thank You.

View 4 Replies View Related

If @@trancount &> 0 Commit Tran

Apr 28, 2003

Hi,

Reviewing the MSSQL process info screen, I am seeing the same process appear a numer of times. It is always the same, being

'IF @@TRANCOUNT > 0 COMMIT TRAN'

Sometimes, there can be up to a hundred of these processes (listed in the process info screen). They generally have a 'sleeping' status, but nonetheless, I would like to see these processes disappear if they are not being used.

I have checked in all of the stored procedures and triggers in the application, and none have this sql statement.

When I run profiler, I get these entries, but the profiler says they belong to either SQL Enterprise Manager or 'Microsoft Windows 2000 Operating System', and not to the application I am running.

Does anyone know where these transactions come from? Can I prevent these from appearing? If no, what is the impact (other than sql server having to maintain a connection).

Thanks,

Jim

View 6 Replies View Related

Growing Tran Log File

May 16, 2006

I have a database of 22 gb in sql 2000, my database option is set to full recovery mode, the problem i'm having is the tran log is growing too fast, this morning it was 24 gb, more than the database size. Can anyone help how I can keep it in a managable size?

Thanks in advance!!

View 2 Replies View Related

Problems With Dump Tran

Mar 23, 1999

Hello,

My Database has 1024 Mb and a log with 384 Mb. The log is 72% full.
None of the options is checked in that DataBase.

I try Dump Tran with no_log, Dump Database and Dump Tran with Truncate_only, click the button of Truncate Transaction Log and more.

And the Log is always the same.

Why I can´t truncate the log? What I must to do?

TIA
[]

View 3 Replies View Related

Tran Log Back Fails

May 14, 2001

All my jobs run fine, except for a Transaction Log Backup job that fails with
the following error: Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL Server 'Server1' as 'sa' (non-trusted)
Starting maintenance plan 'MaintPlan-TLogs- AllData' on 5/12/2001 10:00:01 AM
Backup can not be performed on database 'AllData'. This sub task is ignored.
I have not change the sa or agent password.
I cannot figure out why this job started failing, it ran fine for a while.
Any insight is appreciated.
Thanks

View 1 Replies View Related

Need To Release The TRAN Lock??

Dec 19, 2007

The former programmer wrote this stored procedure. It haven't been run for a while, so I was given the assignment to get it working. When I ran the stored procedure, it took almost 9 hours. Then I found that I can't access a few tables, so my guess it there is some issues with table locking. The stored procedure use this...


Code:


BEGIN TRAN

--blah blah

COMMIT TRAN

ERROR_HANDLER:

ROLLBACK TRAN



Obviously there seem to be a logic error in the middle of the script while running the stored procedure. So, how do I cancel the transaction and unlock the table? I'm unable to access the few tables.

Also, does rebooting the computer helped to release the transaction or table locking?

Thanks...

View 3 Replies View Related

Tran Log Backup Question

Nov 22, 2004

Hi,

I have my tran log backup running every 30 mins. One of the log backups took 36 mins to complete. So at a time I would have two log backups taking place. It seems to me that the 2nd log back up did not happen at all ( I checked in the EM) as the first one wasn't completed by then.

I am kind of lost here as to how to proceed.

Please advise.

Thanks.

View 2 Replies View Related

Large Delete && Tran Log

May 26, 2004

I have a table that has 110 million records, I will be deleting over 60 million records, but I dont have enough space to hold all the deletes on the trans log file. Is there a way to delete 1 million record then free the trans action then run another delete in one script.

View 1 Replies View Related

T-SQL Script For Tran Log With - In Database Name

Jul 23, 2005

Hi,This is probably a trivial question, as I am simply trying to execute aBACKUP LOG database WITH NO_LOG. Except T-SQL will not accept anythingI type when database has a - in it, for example data-base. I havetried:BACKUP LOG 'data-base' WITH NO_LOGBACKUP LOG "data-base" WITH NO_LOGBACKUP LOG (data-base) WITH NO_LOGBACKUP LOG N'data-base' WITH NO_LOGBACKUP LOG N"data-base" WITH NO_LOGBACKUP LOG N('data-base') WITH NO_LOGBACKUP LOG N("data-base") WITH NO_LOGAll T-SQL will tell me is "syntax error" and Books Online has noinformation. So... ???Thank you!

View 1 Replies View Related

BEGIN TRAN . . . WITH MARK . . .

Mar 29, 2006

Hallo All,

Can somebody explain why the same function works different with MS SQL 2000 and MS SQL 2005?



On both systems 2000 and 2005 I have 2x databases named ACCT and PROD (actually only a test environment).



On both systems I try to execute the following statements:



BEGIN TRAN TRAN_01 WITH MARK 'My TRAN_01'

USE PROD

INSERT INTO [PROD].[dbo].[_PROT]([STR_COMMENT], [R_NUM_T1], [R_NUM_T2])

VALUES('PROT_COMMENT', 1004, 1004)

USE ACCT

INSERT INTO [ACCT].[dbo].[_PROT]([STR_COMMENT], [R_NUM_T1], [R_NUM_T2])

VALUES('PROT_COMMENT', 1004, 1004)

COMMIT TRAN TRAN_01



After executing the statements I start the following query:



SELECT * FROM [msdb].[dbo].[logmarkhistory]



On MS SQL 2000 I get as results:



PROD TRAN_01 My TRAN_01 SUPPORTAdministrator 3944000000107600001 2006-03-29 17:15:13.930

ACCT TRAN_01 My TRAN_01 SUPPORTAdministrator 8000000009200001 2006-03-29 17:15:13.930



Seems to be correct. I think it is the way it should work according to the documentation.



On MS SQL 2005 I only get the following results:



PROD TRAN_01 My TRAN_01 SU 29000000107800001 2006-03-29 17:31:32.283



There are no entries in the table for the ACCT database and the account / user_name is shown incorrectly.



It seems to be an ERROR in the processing of such marked transactions in MS SQL 2005.

View 3 Replies View Related

Deletes Causing Tran Log To Fill

Aug 2, 2000

I seem to be having a problem on all of my SQL servers. WHen I or a developer attmept to do a delete on a table i get a Log file for database is full. I truncate the log try again and get the same error. IT doesnt seem to matter how much is being deleted or how big the table is. THis is very strange and very frustrating.

Thanks
David

View 5 Replies View Related

Restoring Tran Logs To Standby

Jan 22, 2001

I have recently implemented a backup solution that keeps our standby server up-to-date with nightly database backup and restores. Ironed out all the problems with syslogins and orphan users. It's been working very well over the past few weeks.

On the production server we do hourly tran log dumps every hour between 8am and 10pm. I would like to implement some form of "log shipping" to bring the window of vulnerability down to 1 hour. By making some alterations to my current process I been able to incorporate the hourly log dumps in the same process.

However, when I try to restore the log on the standby servre I get the following message,
Server: Msg 4305, Level 16, State 1, Line 1
Specified file 'HODB1SQLBACKUPRace_Prd_T_dump.200101231513' is out of sequence. Current time stamp is Jan 23 2001 2:01PM while dump was from Jan 23 2001 3:01PM.

After a bit of investigation I found the dumptrdate field in the sysdatabases table and it was set to Jan 23 2001 14:01. After updating this field to Jan 23 2001 14:01, I ran the load command again but received the same error message.

Is there something else that needs updating on the standby server? Is what I'm trying to do possible in 6.5? Any help or ideas would be greatly appreciated.

Thanks
Phill

View 2 Replies View Related

Tran Log Backup Conflicts With Shrinkdatabase?

Apr 2, 2008

Hi:

I have maintenance plan on DBABC backup log to .trn job to run every 90 minutes (daily).

in order to keep the log file small, I also set up a job (T-SQL) to run at 4:15 am to backup log ABC with truncate_only, then run dbcc shrinkdatabase (DBABC, 10)

it looks "backup log ABC with truncate_only" has conflicts with the every90 minutes backup transaction log.

Question: could I keep the backup transaction log every90 minutes, but still could shrink the log file. The log file is growing very fast.

Or I have to use differential backup instead of backup tran log?

thanks
David

View 4 Replies View Related

Big Tran Logs, &#34;extra&#34; Backup ?

Mar 28, 2002

I noticed our log files are getting way too big. I found that a previous
SQL guy had set up the following scheduled job with the TSQL statement:

BACKUP LOG DEV TO DevDailyTranLog with noinit

This runs every 20 minutes.

There's also a Maint Plan to do a Complete backup every night and a
Transaction Backup every hour (could be set to 20 min)

Why do you suppose the BACKUP LOG job exists ? If the maint plan were
set to backup transaction every 20 min, wouldn't the 2 jobs be
duplicating each other ?

Also, I notice that the Tran Logs specified in the database properties
seem awfully big (4 gig), shouldn't they automatically be truncated when
the daily full backup occurs ? (full recovery model)

Feel free to call me and straighten me out or to get more info.

Win2K, SQL 2K

gdunn@taunton.com
203-426-8171 x 374

View 2 Replies View Related

Missing Records After COMMIT TRAN

Mar 1, 2006

Hi

Can you think about any reason for why when using a transaction after the COMMIT TRAN the inserted new record is not in the table and there is a gap in the identity????

I'm using SQL 2000 SP3, there are no triggers are on the table and it happanes only under heavy load.

Thanks,
Inon.

View 9 Replies View Related

Isnull

Aug 22, 2000

I am trying to delete a row of data that is all nulls. Help in BOL was a little help but it is not working.

View 2 Replies View Related







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