Custom Logging - 'sieving' Messages.

Dec 5, 2007



Hi All,

As Jamie Thomson has written:

http://blogs.conchango.com/jamiethomson/archive/2005/06/11/SSIS_3A00_-Custom-Logging-Using-Event-Handlers.aspx


'...we can attach an event handler to the package...and this one event handler will catch all events raised of that event type by every container in the package...'

Fine. Now what I want to do is catch all OnInformation events generated for the package, and disgard all apart from a subset, whose message contains a particular string. So the Q is, how do I/can I interrogate the message for the event that my handler has just caught?

Michael Coles has come up with a neat method of overriding sp_dts_addlogentry, (http://blogs.sqlservercentral.com/blogs/michael_coles/archive/2007/10/09/3012.aspx), but I want to do this within the package, not outside, to avoid the change becoming global to every package writing to the same sysdtslog90.



Hope this is poss.,

View 4 Replies


ADVERTISEMENT

Tie Together Custom Logging And SSIS Logging?

Sep 12, 2005

I recently read the project real ETL design best practices whitepaper. I too, want to do custom logging as I do today, and also use SSIS logging. The paper recommended using the variable system::PackageExecutionId to tie the 2 logging methods together.

View 4 Replies View Related

Logging Error Messages

May 7, 2002

Hi,

How can I avoid certain messages from SQL Server being recorded into the Event viewer ?
For example, every time I truncate the transaction log with 'Backup log with truncate_only', It is being recorded into the Event viewer as an Error. But, I know that it is not an error.
How can I avoid this ?

Thanks

View 1 Replies View Related

Logging Messages In Query

Feb 25, 2008

Hi,
How to log queryresult messages (not result) into file using sql query?

I am looking for storing results into file like (2 Rows affected) and also error messages thrown by system.Any idea?



Regards
Arun.M


View 10 Replies View Related

Error Messages Logging And Copying.

Jul 26, 2006

Hi:

How can I copy the error messages when I execute a SSIS package?. The Progress tab or the Execution results tab both dont have the means to copy the results. I would like the errors to be output to a text file under a directory on my drive system (some thing like C:SSISExecResults.txt). Is this possible?. If so how do I configure my package to output the package execution results to a text file?.

Any help/suggestions/comments highly appreciated.

Thanks

AK

View 1 Replies View Related

Logging Query Messages From ExecuteSQL Task

Dec 15, 2006

The ExecuteSQL task makes it easy to capture the resultset of a query or stored proc in a variable. But what about the messages that would normally appear in the Messages tab when running queries in Management Studio or Query Analyzer? There must be a way to display and log rowcounts and other messages that a query normally produces.
 
Various package/task logging configrations haven't helped. I've read discussions about logging rowcounts in data flow tasks, but what about capturing messages in ExecuteSQL and other control flow tasks that run T-SQL?
 
I only have enough time to dabble in this technology so I may be missing something obvious or approaching this incorrectly. Any suggestion, reference, constructive criticism or reponse would be appreciated.
 

View 15 Replies View Related

SQL Server Logging Of Service Broker Messages

May 2, 2006

I am writting a huge Service Broker Application. I notice that each message that is processed appears in the SQL Server Logs. Currently I am just testing with a single queue and tons of messages are showing up in the log. Is there a way that I can turn these informational messages off? I think in the end I may have something like 15 or 20 queues. These messages are very useful for debugging but I may not desire this extensive logging to be running all the time on all of my queues.

Gary

View 4 Replies View Related

Why Is SQL 2000 Constantly Logging Starting Up Database Messages?

Nov 21, 2001

The log for our SQL 2000 database shows constant "starting up database dbname" entires. Is there a option that causes the databases to constantly be starting or is this a new feature of SQL 2000.

View 1 Replies View Related

MSSQLServer Logging Many Missing Stored Procedure Messages

Jul 10, 2007

Hello, I am getting many of these messages in my server's event log (approximately 13 every 5 seconds or so). I have tried clearing the queue with "END CONVERSATION @ConvHandle WITH CLEANUP;" but the event log keeps getting messages. I have attached an example below.

Type: Information
Event Source: MSSQLSERVER
Event Category: (2)
Event ID: 9724
Date: 7/10/2007
Time: 3:52:37 PM
Description:
The activated proc [dbo].[SqlQueryNotificationStoredProcedure-32e779eb-edcb-44d1-ba30-93f46ef9d9f8] running on queue HoudiniPlatform.dbo.SqlQueryNotificationService-32e779eb-edcb-44d1-ba30-93f46ef9d9f8 output the following: 'Could not find stored procedure 'dbo.SqlQueryNotificationStoredProcedure-32e779eb-edcb-44d1-ba30-93f46ef9d9f8'.'

View 3 Replies View Related

Custom Error Messages

Jul 20, 2005

My understanding is that in a stored procedure (or any code for thatmatter) if an error occurs you can detect it by checking @@errorvariable and raise your own error with raiserror statement.The problem is that the original error is not suppressed. For exampleI received the following output from a stored procedure from the sameerror:Server: Msg 547, Level 16, State 1, Procedure spUpdateSecurityMaster,Line 49INSERT statement conflicted with COLUMN FOREIGN KEY constraint'FK_SM_mm_Exchange_Exchanges'. The conflict occurred in database'Trading', table 'Exchanges', column 'IsoCode'.Server: Msg 50000, Level 14, State 1, ProcedurespUpdateSecurityMaster, Line 57Unable to insert into "SM_mm_Exchange" tableThe statement has been terminated.So why should we bother to use raiseerror if the orginal error isgoing to be given to the client anyways? The end result is two errormessages.

View 4 Replies View Related

Generating Custom Messages To User

Oct 5, 2006

Hello everyone,

i'm using a foreach loop container to read a group of excel files and pass their information to a Sql Server database. The process runs well but sometimes there could be some excel files that may not be processed correctly so i'm using transacctions to continue to process on the other files, But i'd like to generate a message everytime an excel file is or not processed. I thought that i could generate a flat file to do it, but is there any other way to accomplish this? I'm also generating a log file (on xml format), but It seems too much information for an end-user.

any suggestions?

regards.

View 2 Replies View Related

Custom Error Logging

Dec 22, 2007

Hi,

I have a small requirement in SSIS Error Logging Mechanism.
Presently in my SSIS package i am using a File Connection Manager for creating a Log file.
I have a problem on this regard. Every time when i am executing my DTS package, the error log messages are getting appended to my error log at OS level (say D:error_messg.log). And for this reason whenever my DTS package is getting executed the size of the file is keep on increasing and there by killing my disk space.

I have a requirement for this error logging mechanism. At any time my log file should not exceed more than 20MB.
Or can we remove the log events a week ago or say more than 2 days or say. Just ensuring the log file do not fill up the disk space eventually.

How can we do this?
Any suggestions are greatly appreciated.

Thanks & Regards

View 4 Replies View Related

Handling A SQL Exceptions And Custom Error Messages

Aug 6, 2007

Hello guys,I need some ideas on how to handle an exception or a user defined error message.I have a procedure that creates a new user. Lets say if the e-mail address entered is already in use. What are some of the best practices for notifying the user that the e-mail address is already in use?This is what I was thinking....Solution #1--------------My proc will raise an error with a message id that is great than 50000, then my DAL will recognize this is a user defined error and spit back to the user instead of trapping it.Solution #2--------------The proc should have an output param ( @CreationStatus CHAR(1) ).If the @CreationStatus has a value for example "E", I will have lookup the value for "E" in my app and spit back that custom error message. I don't really like this option because it is too concrete.What are some of the ways you deal with this situation?Your suggestions are greatly appreciated.Thank you!

View 2 Replies View Related

Logging From A Custom Source Adapter

Apr 3, 2006

I'm having alot of trouble figuring out the proper way to log from inside my custom source adapter.

I couldn't find my useful information in MSDN, it mostly applies to logging from inside a script task.

I'd like to log my messages along with all the other SSIS package log entries, which I have going to the dts log table.

I'm assuming I should be using some functionality from Microsoft.SqlServer.Dts.RunTime, probably the LogProvider.

Can anyone advise?

View 3 Replies View Related

Help Understanding Custom Logging In PipelineComponent

Jan 14, 2008



Hi all,

I have a custom component for which I want to log entries, but I a quite new to SSIS and I do not understand ho to access the resulting logs.

I have overriden like this


public override void RegisterLogEntries()

{

LogEntryInfos.Add("Log entry",

"This is the log entry for the component",

Microsoft.SqlServer.Dts.Runtime.Wrapper.DTSLogEntryFrequency.DTSLEF_CONSISTENT);

}

and I am adding log messages like this


private void DtsLogMessage(string message)

{

DateTime now = DateTime.Now;

byte[] additionalData = null;

m_ComponentMetaData.PostLogMessage("Log entry",

m_ComponentMetaData.Name,

message,

now, now, 0, ref additionalData);

}



However, they do not appear in the log viewer.

Can you guys help ?

Thanks !





View 3 Replies View Related

Displaying Custom Error Messages In Reporting Services

Nov 12, 2007

Hi all,
We are displaying an SQL Server 2005 Reporting Services report in our ASP.NET 1.1 application by accessing the report through URL and embedding the same in an iframe HTML web control. The user can export the report contents into CSV format by making use of the export functionality provided by Reporting Services.
Now we have been asked to display a warning mesage to the user when the no. of records in the report exceeds 1 million i.e. if the no. of records in the report exceeds 1 million and the user tries to export the report to CSV format by clicking on the "Exprot" link button, we need to display a warning message to the user.
My doubt is whether this can be done in Reporting Services. Are there any programmatic interfaces exposed by Reporting Services which might help us implement this requirement ?

Thanks,
CodeKracker.

View 4 Replies View Related

OnError Event Handler And Custom Logging

Apr 18, 2008

I'm trying to implement a custom log table. To keep the discussion simple, let's say I only have 1 column in this table and all I want to write in it are

"Start" when the package starts
"Error" when it encounters an error
"Finish" when the package finishes. Even if there was an error, I still want to enter "Finish'.

My Control Flow has 3 task objects, 2 Execute SQL Tasks, and 1 Data Flow Task in between them.

The first Execute SQL Task does an insert statement for the Start and the second Execute SQL Task does an insert for the Finish.

To capture any package errors, I also have an Execute SQL Task (to insert "Error") in the Event Handler for OnError. I see that when I cause an error in my package it can raise multiple OnError events, which will envoke my Execute SQL Task multiple times. (This is good because it will allow me to write a line per error event with the error description.)

The problem I have is, how do I write the "Finish" log when I have an error? If I put the insert for the finish in the same Execute SQL Task with the errors, then it will write a "Finish" for every error. But I can't put it anywhere else because if I put it anywhere else, the package never makes it there because it stops at the OnError Event Handler.

Or is there a way for me to tell the package to do the 2nd Execute SQL Task all the time?

Lastly, is there a better way to do this kind of custom logging?



View 28 Replies View Related

Custom Destination Component Logging - Wrote 0 Rows

Mar 17, 2006

I wrote a custom destination component. Everything works fine, except there is a logging message that is displayed that I cannot get rid of or correct. Here is the end of the output of a package containing my component:

Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning.
Information: 0x0 at Data Flow Task, MyDestination: Inserted 40315 rows into C: empfile.txt
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "MyDestination" (9)" wrote 0 rows.
SSIS package "Package.dtsx" finished: Success.

I inserted a custom information message that contains the correct number of rows written by the component. I would like to either get rid of the last message "... wrote 0 rows", or figure out what to set to put the correct number of rows into that message.

This message seems to happen in the Cleanup phase. It appears whether I override the Cleanup method of the Pipeline component and do nothing, or not. Any ideas?

public override void Cleanup()

{

ComponentMetaData.FireInformation(0, ComponentMetaData.Name,

"Inserted " + m_rowCount.ToString() + " rows into " + m_fileName,

"", 0, ref m_cancel);

base.Cleanup(); // or not

}

View 6 Replies View Related

Event PackageEnd Not Firing - When Custom Logging Programatically

Oct 24, 2007

In my console application code which creates and executes SSIS package I have this code.





Code Block
provider.ConfigString = loggingConnection.Name;
package.LoggingOptions.SelectedLogProviders.Add(provider);
package.LoggingOptions.EventFilterKind = DTSEventFilterKind.Inclusion;
package.LoggingOptions.EventFilter = new string[] { "OnPipelineRowsSent","PackageEnd" };
package.LoggingMode = DTSLoggingMode.Enabled;


I use a custom log component to log the events. However the "PackageEnd" event does not seem to get fired at all.



Am I missing something in this?

Thanks

View 1 Replies View Related

Integration Services :: User Controlled Custom Logging - Capture Source Value Name

Apr 23, 2015

I would like to fire a pre execution event, grab the name of the stored procedure (source of the sql task), insert a record with the name and datetime, and then fire a post event that would update the record with a modified dated.

What is the best way to capture the source value name in the execute sql task.

View 3 Replies View Related

Logging To Event Viewer Fails But SQL Server Logging Works OK - Why?

Jun 18, 2007

Greetings,



I am developing a package on my local workstation. I have defined two logging service providers. One is for SQL Server and the other is for the Windows Event Log. I am using the Dts.Log method in a script task to write log entries.



Logging is working properly with the SQL Server provider and rows are being inserted into the sysdtslog90 table. However, the only events that are being logged in the Windows Event Log are the package start and end events which I believe SSIS is doing automatically anyway.



Is there something I need to do to enable WIndows Event Log logging other than defining a log provider and making sure it is checked active? Won't SSIS write to two different logs with one Dts.Log call? Any ideas on what might be going wrong with my approach?



Thanks,

BCB

View 3 Replies View Related

Logging Package Name For Any Event In Sysdtslog90 Logging Table

Oct 17, 2007



Hi,
I decided to use the SQL Server log provider to store logging data of all my Integration Services packages. I also created some reports about this data for operating purposes.
I have a problem occurs the name of the executing package is not always written to the log,but the name of the single task which failed. But that is not very useful information for operating, because I do not see any chance to get the name of the package by the information which is logged in the sysdtslog90 table in the database which I defined for SSIS Logging.

How do I configure the package to always log the package information into the table, too?


Best regards,
Stefoon

View 5 Replies View Related

Displaying Custom Properties For Custom Transformation In Custom UI

Mar 8, 2007

Hi,

I am creating a custom transformation component, and a custom user interface for that component.

In
my custom UI, I want to show the custom properties, and allow users to
edit these properties similar to how the advanced editor shows the
properties.

I know in my UI I need to create a "Property Grid".
In
the properties of this grid, I can select the object I want to display
data for, however, the only objects that appear are the objects that I
have already created within this UI, and not the actual component
object with the custom properties.

How do I go about getting the properties for my transformation component listed in this property grid?

I am writing in C#.

View 5 Replies View Related

How To Write .net Code To Place XML Messages On Queues And Retrieve XML Messages From Queues.

Apr 2, 2008

Hello, please help!!

I have spent days searching the web and forums for an answer to this simple question and cannot find an example.

I have built a service broker application on sql server 2005. The application puts some xml on an incoming queue which is basically a few parameters to be used in a query. This queue will then call a stored proc which does some business logic and puts the resulting results in another queue also in xml.

I have written a test harness in SQL to put messages on the inbound queue and then some sql to retrieve the returned code from the outbound queue.

What I want to do is be able to convert the SQL which does this into .net code to be used by an application. i.e. write in .net some code to put xml on a queue and then write some .net code to retrieve xml from another queue.

I wouldn't have thought this would be a difficult thing to do and would have been done hundreds of times, but unable to find anything to simply send and retrieve XML to service broker queues....

thanks for your help.. its really needed. I found some links, but they are really vague and often doing select statments in service broker or something like this. I don't want to call any sql, just send and recieve XML on the queues.

any example code that does this, would be really helpfull

kind regards,
David Weeden
Database Developer

View 2 Replies View Related

Expression Editor On Custom Properties On Custom Data Flow Component

Aug 14, 2007

Hi,

I've created a Custom Data Flow Component and added some Custom Properties.

I want the user to set the contents using an expression. I did some research and come up with the folowing:





Code Snippet
IDTSCustomProperty90 SourceTableProperty = ComponentMetaData.CustomPropertyCollection.New();
SourceTableProperty.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
SourceTableProperty.Name = "SourceTable";






But it doesn't work, if I enter @[System:ackageName] in the field. It comes out "@[System:ackageName]" instead of the actual package name.

I'm also unable to find how I can tell the designer to show the Expression editor. I would like to see the elipses (...) next to my field.

Any help would be greatly appreciated!

Thank you

View 6 Replies View Related

Expression Issue With Custom Data Flow Component And Custom Property

Apr 2, 2007

Hi,



I'm trying to enable Expression for a custom property in my custom data flow component.

Here is the code I wrote to declare the custom property:



public override void ProvideComponentProperties()

{


ComponentMetaData.RuntimeConnectionCollection.RemoveAll();

RemoveAllInputsOutputsAndCustomProperties();



IDTSCustomProperty90 prop = ComponentMetaData.CustomPropertyCollection.New();

prop.Name = "MyProperty";

prop.Description = "My property description";

prop.Value = string.Empty;

prop.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;



...

}



In design mode, I can assign an expression to my custom property, but it get evaluated in design mode and not in runtime

Here is my expression (a file name based on a date contained in a user variable):



"DB" + (DT_WSTR, 4)YEAR( @[User::varCurrentDate] ) + RIGHT( "0" + (DT_WSTR, 2)MONTH( @[User::varCurrentDate] ), 2 ) + "\" + (DT_WSTR, 4)YEAR( @[User::varCurrentDate] ) + RIGHT( "0" + (DT_WSTR, 2)MONTH( @[User::varCurrentDate] ), 2 ) + ".VER"



@[User::varCurrentDate] is a DateTime variable and is assign to 0 at design time

So the expression is evaluated as: "DB189912189912.VER".



My package contains 2 data flow.

At runtime,

The first one is responsible to set a valid date in @[User::varCurrentDate] variable. (the date is 2007-01-15)

The second one contains my custom data flow component with my custom property that was set to an expression at design time



When my component get executed, my custom property value is still "DB189912189912.VER" and I expected "DB200701200701.VER"



Any idea ?



View 5 Replies View Related

Adding Custom Property To Custom Component

Aug 17, 2005

What I want to accomplish is that at design time the designer can enter a value for some custom property on my custom task and that this value is accessed at executing time.

View 10 Replies View Related

Custom Task - Custom Property Expression

Aug 16, 2006

I am writing a custom task that has some custom properties. I would like to parameterize these properties i.e. read from a varaible, so I can change these variables from a config file during runtime.

I read the documentation and it says if we set the ExpressionType to CPET_NOTIFY, it should work, but it does not seem to work. Not sure if I am missing anything. Can someone please help me?

This is what I did in the custom task

customProperty.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;

In the Editor of my custom task, under custom properties section, I expected a button with 3 dots, to click & pop-up so we can specify the expression or at least so it evaluates the variables if we give @[User::VaraibleName]

Any help on this will be very much appreciated.

Thanks

View 3 Replies View Related

SQL 6.5 Messages

Feb 15, 1999

Trying to obtain a full list of SQL 6.5 error messages into a file. There are
2,215 messages present in master.sysmessages, but there is a total of 2,733
messages listed in the dialog box within enterprise manager. Message numbers
17026 thru 19020 don't seem to be stored in the sysmessages table.

Anyone know how I could obtain an extract to obtain a full list of messages ?

View 2 Replies View Related

Messages Are Gone.

Apr 15, 2008



After sending a message the message is just gone.
Our transmissionand and out our transactionqueue is empty.

This is our CLIENT:
CREATE MESSAGE TYPE HelloWorldMessage
VALIDATION = WELL_FORMED_XML ;
GO
CREATE CONTRACT HelloWorldContract
( HelloWorldMessage SENT BY INITIATOR);
GO
CREATE QUEUE [dbo].[InitiatorQueue] ;
GO
CREATE SERVICE InitiatorService
ON QUEUE [dbo].[InitiatorQueue];
GO
drop endpoint SqlEndpoint
CREATE ENDPOINT SqlEndpoint
STATE = STARTED
AS TCP (LISTENER_PORT = 1235, LISTENER_IP =ALL)
FOR service_broker(AUTHENTICATION = WINDOWS)
GO
use master
GRANT CONNECT ON ENDPOINT:qlEndpoint to public
GO
use test1
DROP ROUTE SqlRoute
GO
CREATE ROUTE SqlRoute
AUTHORIZATION [dbo]
WITH
SERVICE_NAME = 'TargetService',
BROKER_INSTANCE = '80EFDE56-4088-4015-B6C0-D12285C60F66',
ADDRESS = 'TCP://localhost:5900';
GO

GRANT SEND ON SERVICE::[TargetService] to public

create master key
encryption by password = 'azertyuiopqsdfghjklm'
go


SERVER

CREATE MESSAGE TYPE HelloWorldMessage
VALIDATION = WELL_FORMED_XML ;
GO
CREATE CONTRACT HelloWorldContract
( HelloWorldMessage SENT BY INITIATOR);
GO
CREATE QUEUE [dbo].[InitiatorQueue] ;
GO
CREATE SERVICE InitiatorService
ON QUEUE [dbo].[InitiatorQueue];
GO
drop endpoint SqlEndpoint
CREATE ENDPOINT SqlEndpoint
STATE = STARTED
AS TCP (LISTENER_PORT = 1235, LISTENER_IP =ALL)
FOR service_broker(AUTHENTICATION = WINDOWS)
GO
use master
GRANT CONNECT ON ENDPOINT:qlEndpoint to public
GO
use test1
DROP ROUTE SqlRoute
GO
CREATE ROUTE SqlRoute
AUTHORIZATION [dbo]
WITH
SERVICE_NAME = 'TargetService',
BROKER_INSTANCE = '80EFDE56-4088-4015-B6C0-D12285C60F66',
ADDRESS = 'TCP://localhost:5900';
GO

GRANT SEND ON SERVICE::[TargetService] to public

create master key
encryption by password = 'azertyuiopqsdfghjklm'
go
Hopefull you have an idea?

View 1 Replies View Related

No Help From The Error Messages

Dec 4, 2007

I am writing a tracking system. There is a table in the Sql Server 2000 database that contains a column for the user's ntid, the page they visited, the date of the last visit, a column each to track hits for the current year and a previous year column (basically for archiveing and reporting purposes), and 12 columns for hits per month (obviously, one per column). To record a hit, my unit determined we would only track one hit per day, so basically, there are 3 possible outcomes I needed to account for :
1) A user had never hit the page before, so I need to record the user's ID, the page they hit for the first time (since it won't exist yet), increment the year counter for that user on that page, and then determine what month column counter should be incremented as well.
2) A user had hit the page before, but not on this same day, so I need to update the row for that user on that page, changing the last visit field to reflect the current date, and icnrementing the appropriate counters.
3) A user had hit the page already on the same day, so basically, nothing should be changed whatsoever. No action should be taken.
I wrote a stored procedure to attempt to accomplish that logic, and though it's probably not very pretty, I was surprised at how few errors I got on my first Syntax check. Here's the stored procedure :
CREATE PROCEDURE sp_hitMe@ntid varchar(10),@page varchar(50),@thisHit datetimeASSET NOCOUNT ON
DECLARE @tempDate datetimeDECLARE @yearCount intDECLARE @monthCount intDECLARE @inMonth varchar(20)DECLARE @monthColumn varchar(10)SET @inMonth = DATENAME(mm, @thisHit)SET @monthColumn =  CASE   WHEN @inMonth = 'January' THEN 'hitsInJan'  WHEN @inMonth = 'February' THEN 'hitsInFeb'  WHEN @inMonth = 'March' THEN 'hitsInMar'  WHEN @inMonth = 'April' THEN 'hitsInApr'  WHEN @inMonth = 'May' THEN 'hitsInMay'  WHEN @inMonth = 'June' THEN 'hitsInJun'  WHEN @inMonth = 'July' THEN 'hitsInJul'  WHEN @inMonth = 'August' THEN 'hitsInAug'  WHEN @inMonth = 'September' THEN 'hitsInSep'  WHEN @inMonth = 'October' THEN 'hitsInOct'  WHEN @inMonth = 'November' THEN 'hitsInNov'  WHEN @inMonth = 'December' THEN 'hitsInDec'  END DECLARE @insString varchar(500)DECLARE @updString varchar(500)SET @insString = 'INSERT INTO tblTracking (ntid, page, lastVisit, hitsThisYear, ' + @monthColumn + ') VALUES (' + @ntid + ', ' + @page + ', ' + @thisHit + ', 1, 1)'
if exists(select * from tblTracking where ntid = @ntid and @page = page) begin  if exists(select * from tblTracking where lastVisit = @thisHit)   begin    -- DO NOTHING!   end  else   begin    DECLARE @theColumn varchar (100)    SET @theColumn = 'SELECT ' + @monthColumn + ' FROM tblTracking WHERE ntid = @ntid AND @page = page'    SET @yearCount = (SELECT hitsThisYear FROM tblTracking WHERE ntid = @ntid AND @page = page) + 1    SET @monthCount = (Exec @theColumn)    SET @monthCount = @monthCount + 1    SET @updString = 'UPDATE tblTracking SET lastVisit = ' + @thisHit + ', hitsThisYear = ' + @yearCount + ', ' + @monthColumn + ' = ' + @monthCount + ' WHERE ntid = @ntid AND @page = page'    Exec @updString   end endelse begin  Exec @insString endGO
And to my surprise, the only 3 errors I got were :
Server: Msg 156, Level 15, State 1, Procedure sp_hitMe, Line 39Incorrect syntax near the keyword 'end'.Server: Msg 156, Level 15, State 1, Procedure sp_hitMe, Line 45Incorrect syntax near the keyword 'Exec'.Server: Msg 156, Level 15, State 1, Procedure sp_hitMe, Line 50Incorrect syntax near the keyword 'end'.
However, these are of course so vague as to be useless to me. What's wrong with the procedure? What have I missed?

View 9 Replies View Related

Private Messages

Sep 26, 2005

i'm trying to make private messages like the one in this site, i didnt start programming yet, the problem is in the DB schema, i have 3 tables (Users, Messages, MessageDetails) i think the problem that the UserID is related to the other two Tables, so to know the sender and reciever, when i try to view all messages for specific user and show all users who sent it, it give nothing back, so any help in the DB, thanx 4 help.

View 13 Replies View Related

SQL Error Messages

Mar 9, 1999

Is there a way to return the SQL Native error to a Visual Basic program?

View 3 Replies View Related







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