Creating a Flag within a Stored procedure

  • Hey guys!

    Cut along story short, iv built an application in VB.net that allows me to upload them to SQL 08 through a connection string, but within the txtfile there is a word called SLA Breach which hasnt got a value assigned to it at the moment, so what im asking and if this is possible to create a sotred procedure with a flag in it? for when i txt file is uploaded the procedure will go off and search the upload for that word. and if the word is there then it would flag it....

    Is something like possible?

    Thanks in Advance

  • Anything is possible.

    The probability of survival is inversely proportional to the angle of arrival.

  • scott.atkins (8/11/2010)


    Hey guys!

    Cut along story short, iv built an application in VB.net that allows me to upload them to SQL 08 through a connection string, but within the txtfile there is a word called SLA Breach which hasnt got a value assigned to it at the moment, so what im asking and if this is possible to create a sotred procedure with a flag in it? for when i txt file is uploaded the procedure will go off and search the upload for that word. and if the word is there then it would flag it....

    Is something like possible?

    Thanks in Advance

    What is happening to the rest of the data in the text file? Is it being parsed out into columns in a table? In more than one table? Is it just being stored as text in a single column?

    You can do this, but there are many ways to do this. If you can be more specific and perhaps post an example, we can figure out the way that works for you.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • apologies should of added more information

    below is the information within the txt.files and i have 47 files roughly with 500+ words in each

    24/06/2010 19:18:23 /IServerManager.GetPublicKey (timings: authenticate=0 authorise=0 execute=0 logError=0 teardown=0 total=0)

    24/06/2010 19:18:23 /IServerManager.Login (timings: authenticate=0 authorise=0 execute=4524029 logError=0 teardown=468003 total=4992032)

    24/06/2010 19:20:31 /IServerManager.GetPublicKey (timings: authenticate=0 authorise=0 execute=0 logError=0 teardown=0 total=0)

    As you can see there is alot of information but what i want to be able to do is reference keys words out of them,

    Iv just finished writing a application within VB.net that allows me to read txt.files and then im giving the user the option to upload them, which will be connected to a SQL database through a connection string.

    Iv already created the database in SQL see below and you will notice that the column names reference bits within the txt.file above.

    CREATE TABLE [dbo].[MedWayFiles](

    [RowID] [int] IDENTITY(1,1) NOT NULL,

    [Date and Time] [datetime] NULL,

    [Commands] [nvarchar](50) NULL,

    [Timings] [nvarchar](50) NULL,

    [Authenticate] [nvarchar](50) NULL,

    [Authorise] [nvarchar](50) NULL,

    [Execute] [nvarchar](50) NULL,

    [LogError] [nvarchar](50) NULL,

    [TearDown] [nvarchar](50) NULL,

    [Total] [nvarchar](50) NULL,

    [SLA Breach] [nvarchar](50) NULL,

    CONSTRAINT [PK_MedWayFiles] PRIMARY KEY CLUSTERED

    im just looking to pull the values from the txt.files and load them to an SQL Database...

  • scott.atkins (8/11/2010)


    apologies should of added more information

    below is the information within the txt.files and i have 47 files roughly with 500+ words in each

    24/06/2010 19:18:23 /IServerManager.GetPublicKey (timings: authenticate=0 authorise=0 execute=0 logError=0 teardown=0 total=0)

    24/06/2010 19:18:23 /IServerManager.Login (timings: authenticate=0 authorise=0 execute=4524029 logError=0 teardown=468003 total=4992032)

    24/06/2010 19:20:31 /IServerManager.GetPublicKey (timings: authenticate=0 authorise=0 execute=0 logError=0 teardown=0 total=0)

    As you can see there is alot of information but what i want to be able to do is reference keys words out of them,

    Iv just finished writing a application within VB.net that allows me to read txt.files and then im giving the user the option to upload them, which will be connected to a SQL database through a connection string.

    Iv already created the database in SQL see below and you will notice that the column names reference bits within the txt.file above.

    CREATE TABLE [dbo].[MedWayFiles](

    [RowID] [int] IDENTITY(1,1) NOT NULL,

    [Date and Time] [datetime] NULL,

    [Commands] [nvarchar](50) NULL,

    [Timings] [nvarchar](50) NULL,

    [Authenticate] [nvarchar](50) NULL,

    [Authorise] [nvarchar](50) NULL,

    [Execute] [nvarchar](50) NULL,

    [LogError] [nvarchar](50) NULL,

    [TearDown] [nvarchar](50) NULL,

    [Total] [nvarchar](50) NULL,

    [SLA Breach] [nvarchar](50) NULL,

    CONSTRAINT [PK_MedWayFiles] PRIMARY KEY CLUSTERED

    im just looking to pull the values from the txt.files and load them to an SQL Database...

    OK, thanks for the additional data.

    I have a couple of questions about the table you've created. Why are you using nvarchar instead of varchar? If you don't have any non-standard characters to upload, you should use varchar as nvarchar takes twice the space.

    What is the actual size of the data you'll be putting into these fields? You've allocated 50 characters to each, which seems odd. Have you looked at the maximum length of the strings that'll go into each field? If they won't be that long, you should make the size of the field more appropriately short and if they'll be longer, you're going to crash unless you increase that number. Going over this and setting more appropriate sizes will help your future development.

    It looks like your fields authenticate, authorise, execute, logError, teardown and total are all integers. You should declare those fields as int.

    If you just want the one table, you should parse the file on the VB side and populate each field in the table in your initial query. This would likely be easier for you as a VB developer than trying to do it all in a stored procedure.

    If you have any further questions or clarifications, please ask.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply