Read Parts Of Unformatted Fields String

Apr 23, 2014

I have a field that will look something like this. I need to read a file and when the first 3 positions are REM, the number following is the Order number, and the initials, are the rep. this is how they are tracking for the rep, if they sent reminders to customers and when.

REM 0482348 LV 04/13

I would like to do this in SQL and also join to the order header file that will give me the invoice total for that order. what is the best approach here via SQL for these first 2 fields' needed?

View 1 Replies


ADVERTISEMENT

SQL Server 2012 :: XML - Updating Parts Of Fields

May 30, 2014

I have a table where one of the fields contains XML as in the following. Is there an SQL update statement that can change any occurrences of timezoneIdfrom 0 to 1, and timezone from America/New_York to America/Chicago and time to time - 1 hour?

<scheduleitem><schedule><frequency><weekly weeklyInterval="1"><WED/></weekly></frequency><startDate>2008-08-05</startDate><time>22:30:00</time><timezoneId>0</timezoneId><timezone>America/New_York</timezone></schedule></scheduleitem>

After the query is run, rows like the above would be changed to

<scheduleitem><schedule><frequency><weekly weeklyInterval="1"><WED/></weekly></frequency><startDate>2008-08-05</startDate><time>21:30:00</time><timezoneId>1</timezoneId><timezone>America/Chicago</timezone></schedule></scheduleitem>

View 6 Replies View Related

Deleting Parts Of A String

Mar 18, 2014

The issue is that I need to delete parts of this string using SQL Server.This string is a title of a document which should contain only the Document Category & Title. Instead, it is displaying extra parts such as Year, Date Created, etc. I would like to truncate/parse off the title. The database is Acme_system. The name of the table is dbo.documents, the column name for the title is "title" and there is also column is "childcat".

The title string reads:

2013-730-DAILY NOTES AND TRACKING FORM-11-16-13 700-030714

I want to take off everything except for "DAILY NOTES AND TRACKING FORM-11-16-13 700"

View 9 Replies View Related

Deleting Parts Of String

Mar 18, 2014

The issue is that I need to delete parts of this string using SQL Server.

This string is a title of a document which should contain only the Document Category & Title. Instead, it is displaying extra parts such as Year, Date Created, etc. I would like to truncate/parse off the title. The database is Acme_system. The name of the table is dbo.documents, the column name for the title is "title" and there is also column is "childcat".

The title string reads:

2013-730-DAILY NOTES AND TRACKING FORM-11-16-13 700-030714

I want to take off everything except for "DAILY NOTES AND TRACKING FORM-11-16-13 700"

View 3 Replies View Related

Returning Specific Parts Of A String

Apr 24, 2008

I have a field that contains text strings that always follow this syntax "ABC:DE:comment follow". I want to return a new field with only whatever is between the two : (in this case DE but it could be more). It would be perfect if all the field follow that syntax, however, I have variations where users put spaces either before or after the :. Can the spaces be ignored?

Thank you for any help.

View 4 Replies View Related

SQL Server 2012 :: Convert Parts Of String To Int

May 2, 2014

I have log files that I am loading into a table with duration data in the format "xx hrs xx min xx sec". Only the parts that are required will be there so if duration is only 2 seconds , the column will show "2 sec".

I am trying to get the duration into in to do some analysis on it and I have come up with this query so far which returns the correct data but i am wondering if there is a way to do what I am trying in a more readable format.

CREATE TABLE #tmp(duration VARCHAR(20))

INSERT INTO #tmp
VALUES ('1 hrs 20 min 12 sec'), --4812 sec
('48 sec'), --48 sec
('39 min 1 sec'), --2341 sec
('11 hrs 1 min 1 sec'), --39661 sec
('59 min 0 sec'), --3540 sec
('2 min 50 sec') --170 sec

And this is what I have so far

SELECT CASE
WHEN CHARINDEX('hrs', duration, 1) <> 0 THEN CAST(SUBSTRING(duration, 1, CHARINDEX(' hrs', duration, 1) - 1)AS int) * 3600 + CAST(SUBSTRING(duration, CHARINDEX(' hrs', duration, 1) + 5, CHARINDEX(' min', duration, 1) - 7)AS int) * 60 + CAST(SUBSTRING(duration, CHARINDEX(' min', duration, 1) + 5, CHARINDEX(' sec', duration, 1) - 14)AS int)
WHEN CHARINDEX('hrs', duration, 1) = 0

[Code] ...

I ultimately plan on converting this to a SSIS expression so that is why I am looking to simplify it.

View 3 Replies View Related

How Can I Read Type Of All Fields In Joined Query?

Nov 29, 2007

How can I read type of all fields in joined query?
Is there a stored procedure method to use for this purpose?
 
Thanks

View 3 Replies View Related

OLE DB Command... Read Returned Fields From Query...

Apr 16, 2007

Dear Friends,

I have an OLE DB Command inside an ETL. I want to execute a stored procedure that returns 2 fields, for example:





CREATE PROCEDURE sp_Name

AS

SELECT Field1, Field2 FROM Table





How can I continue the dataflow? How can I return the values from the query? Returns only a row...

View 10 Replies View Related

How To Read Third Word From A String?

Feb 6, 2007

Hallow, everyone:

I want to read third word from a string. For example, the string is,

ABCDE fghijk 031 LPN OPQ

I need 031. How to read it?

Any help will be appreciated.

Thanks

ZYT

View 12 Replies View Related

How To Read Particular Number From String?

Dec 14, 2007

I have table (log)as below

ID---Qstring----------------------------------------------ProID
1----ID=25375
2----ID=23382
3----lngSessionId=134513044&pid=25375
52---lngSessionId=133466044&pid=27890
67---tduid=dc79b&url=http://www.mydomain.co.uk/proddetails.asp?id=186

How do I read only the number starts with ID and pid from the above string and insert into column 'ProID' of the same row? It is log table tracking all the visiters to the web site. The number next to IDs and pids are productIDs. So if I manage to get product ID to the column ProId then I can hit against other table to find out which product the customer clicked.

I planned to do the above said by trigger. Please help

View 7 Replies View Related

Unable To Read Connection String ??

Mar 18, 2008

 I have app.config<connectionStrings>



    <add
name="OrganizationConnectionString" connectionString="Data
      Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|inDebugDatabaseOrganization.mdf;Integrated
Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient"/></connectionStrings>Code behind:

string ConnString
= ConfigurationManager.ConnectionStrings["OrganizationConnectionString"].ConnectionString; I am getting "ConnString" value null. How handle this? 

View 4 Replies View Related

How To Read Return Value From Sqlpipe Send(string) Method

Apr 26, 2006

Hi guys,

How can i read in my C# client application values returned from sqlpipe
send(string)/send(reader method from CLR stored procedure.....following
is example of a stored procedure.I want to read datetime string in my
C# client



Thanks



[Microsoft.SqlServer.Server.SqlProcedure]

public static void PrintToday()

{

// Put your code here

SqlPipe p;

p = SqlContext.Pipe;

p.Send(System.DateTime.Today.ToString());

}

View 3 Replies View Related

Finding Fields In String

Apr 28, 2006

I have data looks like below

23-4c-4f-3rd-2
23-5c-4ad-3-2

THis is all in one field. I need to use sql to take out the data between the 1st and third hyphens to return

4c-3rd
5c-4ad

View 2 Replies View Related

Search And Update All Fields That Contains String

Jan 8, 2008

I hava at large database and I need to search all tables for the string 'NaN' and replace it to null to enable conversion.

Is there any way to do this so that i do not need to write an update query for every column?

Would appretiate an example if anyone knows how to manage this.

Thanks!

View 2 Replies View Related

Creating A String From Date Fields

Jul 20, 2005

I have a table with a startdatetime and an enddatetime column such as:StartDateTime EndDateTime what I want to see returnedis:01/29/2004 10:30AM 01/29/2004 1:30PM "1/29/2004 10:30AM - 1:30PM"01/29/2004 10:30AM 01/30/2004 1:30PM "1/29/2004 10:30AM - 1/30/20041:30PM"01/29/2004 10:30AM 01/30/2004 10:30AM "1/29/2004 10:30AM - 1/30/200410:30AM"Maybe someone has accomplished this aready in a stored procedure andhas an example of how to do it?lq

View 2 Replies View Related

SQL Trigger For Trimming String Fields

Jul 20, 2005

greetings!! the below trigger works fine in SQL 2000 and doesn't takeup much resources, it's a very simple solution to trim text fields atinput in SQL. I know a lot of folks will say to create input masks atthe UI level and that SQL is a restricted back-end DB, but to be quitehonest I don't trust those UI guys and as a DBA I will have to cleanthe mess when they forget to validate. Hope it can be usefull to anyof you too. ;)----------------------------------------------------------------------CREATE TRIGGER [TRIMMER_TGR] ON [dbo].[MyTable]AFTER INSERT, UPDATEASIF UPDATE (MyStringField)DECLARE @TRIMMEDFIELD NVARCHAR(50)DECLARE @MYID INTSELECT @TRIMMEDFIELD = MyStringField from InsertedSELECT @MYID = ID from InsertedBEGINUPDATE tblDocket SET MyStringField = RTRIM(LTRIM(@TRIMMEDFIELD))WHERE ID = @MYIDEND

View 6 Replies View Related

How To Search For Fields Containing A Specific Text String

May 26, 2006

Hi All,I'm familiar with the syntax that looks like this:SELECT * FROM Users WHERE Email LIKE '%aol%'Which would return all users that whose Email column contains "aol".However, if I wanted to do that sort of a search using a prepared statement, how would I do it?I can't simply doSELECT * FROM Users WHERE Email LIKE '%@MatchAgainst%'Can somebody clue me in?

View 1 Replies View Related

CSV Export With Single Quotations For String Fields

Sep 20, 2007

Hi
I need to export data to CSV file from Sql Reporting Services.
I am including single quotations in my view to display in SRS for string fields.
After export if we open in Notepad, for string field it is adding multiple quotations.

How to add single quotations for string fields - CSV files,

Please let me know if anybody knows.

Thx
Vijji

View 4 Replies View Related

Grouping Sorting String And Numerical Fields

Feb 6, 2007

I've got a report built and I'm trying to figure out how sorting and grouping works. I can group the report by Patient, Albumin and it groups as I would expect.

Patient Date Albumin
Adams, John 01/28/2007 4.1
Adams, John 12/30/2007 3.9
Adams, John 01/15/2007 3.2
Barker, Mark 01/18/2007 4.3
Barker, Mark 01/22/2007 4.1
Barker, Mark 01/05/2007 3.9

However, when I try to group by Albumin, Patient, it just sorts by Albumin.
Patient Date Albumin
Barker, Mark 01/18/2007 4.3
Adams, John 01/28/2007 4.1
Barker, Mark 01/22/2007 4.1
Adams, John 12/30/2007 3.9
Barker, Mark 01/05/2007 3.9
Adams, John 01/15/2007 3.2

What I'm looking for is this:
Patient Date Albumin
Barker, Mark 01/18/2007 4.3
Barker, Mark 01/22/2007 4.1
Barker, Mark 01/05/2007 3.9
Adams, John 01/28/2007 4.1
Adams, John 12/30/2007 3.9
Adams, John 01/15/2007 3.2

Is this something that can be done with grouping and sorting?

Thanks,
Chad

View 1 Replies View Related

Help With SQL Statement To Find First And Last Populated Field In String Of Fields

Jun 21, 2006

Hello all,I'm at a loss on how to do this. We're using MS SQL 2000 Server and Ihave a list of fields I need to find the first and last entry for.Here's an example of the table:Number - VarChar(10)Jan - IntFeb - IntMar - IntApr - IntMay - IntJune - IntANd it'll look something like this:NumberJanFebMarAprMayJun12322001901922012032054432433322 4565423754694665And I need to create a table with this:NumberFirstLastDifference123220020554432433456235423754665-89I'm not sure if this'll copy over correctly, but I have gaps in thedata so I can't just say Jun-Jan, but I need tofind the first fieldwith data and last field with data, then find the difference of these.Suggestions? Is there a loop or something I can do in TSQL that'll dothis? I'd like to do this in Query Analyzer since it's just a one-timereport. Thanks --Alex

View 2 Replies View Related

Integration Services :: How To Read A Specific String From Text File As Output Variable In SSIS

Nov 5, 2015

I am downloading a webpage as a text file in order to read a specific string to assign it as a variable/parameter in order to create an output file name. I would like to know how would I be able to look for a specific string and output as another variable for the rest of the package.

2015 Conforming Loan Limits
------------------------------------------------------------------------
o _Loan Limits for Calendar Year 2015--All Counties _[XLS]
</DataTools/Downloads/Documents/Conforming-Loan-Limits/FullCountyLoanLimitList2015_HERA-BASED_FINAL_FLAT.xlsx>_ ,
_[PDF]
</DataTools/Downloads/Documents/Conforming-Loan-Limits/FullCountyLoanLimitList2015_HERA-BASED_FINAL.pdf>_
​ o _List of 46 Counties with Increases in Loan Limits for 2015

[Code] ...

To explain it a more better way, I have a sample webpage text here. I should be searching for "FullCountyLoanLimitList" appended by the current year (like FullCountyLoanLimitList2015) and copy the entire file name in the text file and assign it to another variable so that I can download that specific file using WebClient connection.

View 4 Replies View Related

SQL Server 2008 :: Remove Double Quote In String Fields

Feb 23, 2015

I have a SQL select syntax as below

0 AS SalaryMin,
2088 AS SalaryMax,
2088 AS BillableHours,
'Month' AS SalaryPaidCode,
0 AS SalaryBreakdownHourly,
0 AS SalaryBreakdownDaily,

[Code] ...

While outputting to CSV.file

I got :0,2088,2088,"Month",0,0,0,0,0,0,0,"N/A","N/A","G","N/A","Exempt","Other",1

How can I remove all double quotes in the string fields? so that O can get the result as below while the output
0,2088,2088,Month,0,0,0,0,0,0,0,N/A,N/A,G,N/A,Exempt,Other,1

View 7 Replies View Related

Update Trigger: COLUMNS_UPDATED Evaluates To True For All String Fields

Jul 14, 2006

I have a trigger that writes changes to an audit table. In the case of Updates, I only want to write out the fields that have actually changed. My code for COLUMNS_UPDATED evaluates to true for all varchar fields, even when they haven't changed. All other scenarios appear to be working correctly.



WHILE @field < @maxfield
BEGIN
SELECT @field = min(ORDINAL_POSITION) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName AND ORDINAL_POSITION > @field
SELECT @bit = (@field - 1 )% 8 + 1
SELECT @bit = power(2,@bit - 1)
SELECT @char = ((@field - 1) / 8) + 1

IF ((@TriggerType = 'I') OR (@TriggerType = 'D') OR (@TriggerType = 'U' AND substring (COLUMNS_UPDATED(),@char, 1) & @bit > 0))
BEGIN..........

END

END

Ideas? Thanks!

View 1 Replies View Related

Contact Form - Variable Number Of Input Fields, Store Data As Xml String ?

Jul 13, 2007

Im trying to determine the best way to store data gathered from a form that a user will fill out online.  The form is dynamic and is customized at run time based on group-specific criteria.  The end result is a form that might have 3 extra text boxes, 2 extra sets of radio buttons and a freeform textbox, whereas for another group, there might be a slightly different set of input fields.   Now comes the issue of storing this data.  Since the fields can be somewhat dynamic, it could get tricky to define table columns for each possible input field.  So Im considering storing the data as xml.  Has anyone else had to build custom forms and ended up storing the data as xml ?

View 2 Replies View Related

Web Parts Without Personalization

Aug 17, 2007

i am using web parts with drag and drop feature , i did not use aspnetdb  for user membership
 while it is published it gives eror as follows
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:

If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Please give me ur valuable advice , thanks in advance

View 2 Replies View Related

What&#39;s The Best Way To Dupe Certain Parts Of My RS?

May 29, 2002

Hi!
Mgmt just decided that the designer (me) was more valuable than the developer (now me). I hope there are some gurus out there who can help.

What would be the best way to duplicate certain parts of my RS? Suppose
I have a table with three columns: ID, adName, and priority. When I serve the ads, I am randomizing them, but would like to serve some more frequently than others. I am hoping there is a single query I can use, that will seed the RS with multiple instances of high-priority records.

Should I stick to play-doh?

View 1 Replies View Related

Date Parts In SQL V6.5

Mar 10, 2003

I am still using SQLv 6.5 and have a need to do monthly reports. It is my understanding that there is no inherent capability in SQL v6.5 for functions such as MONTH getdate() as exist in SQL 2000. Does anyone know of a script that will simulate this so I can extract information from a database such as date_last_update IN MONTH 02?

Thanks

Dale

View 3 Replies View Related

SQL Pieces-parts

Jul 20, 2005

I'm very familiar with Oracle at a conceptual level and need tounderstand MSSQL as well. Can anyone point me to a document/web pagethat describes the different files used in MSSQL and a discussion of howthey relate? (ex. with Oracle, there is tempdb, redo, archive, db files,rollback, etc.)

View 4 Replies View Related

Certain Numeric Fields Not Read From The Excel File When Using A Excel File Source.

Jul 20, 2006

I have the Excel Connection Manager and Source to read the contents from an Excel file. For some reason couple of numeric fields from the Excel worksheet are brought over as nulls even though they have a value of 300 and 150. I am not sure why this is happening. I looked into the format of the fields and they are set to General in Excel, I tried setting them to numeric and that did not help.

All the other content from the excel file is coming thru except for the 2 numeric fields.

I tried to bring the contents from the excel source to a text file in csv format and for some reason the 2 numeric fields came out as blank.

Any inputs on getting this addressed will be much appreciated.

Thanks,

Manisha

View 5 Replies View Related

Getting Parts Of DateTime Field

Jun 8, 2008

Hi everyone,
I want to get year, month, day and time parts of a DateTime field in sql,
Can help me?

View 1 Replies View Related

Tell Me Some Third Parts Monitoring Tools

Mar 15, 2002

Hi, gurus:

Please tell me some third parts monitoring tools for MS SQL server 2000.

View 1 Replies View Related

Splitting Dataset In 2 Parts

Mar 22, 2012

I have 5 records in a table called "testing" as such:

LetterCdcontact_id
x1
x2
x3
x4
x5

How can I split this dataset so that three records have LetterCd = 'y' and the other 2 records have LetterCd = 'x'? The number of records can vary, but the idea is the same: split the values in the LetterCd column evenly (50% = 'x', 50% = 'y'). LetterCd is varchar(25) and contact_id is int. I can't update the data, it would have to be a SELECT statement with some sort of CASE statement to get the remainder of the record count?

View 8 Replies View Related

Select Parts Of Information

Apr 20, 2008

Hey guys,

I was wondering if this is possible I have to be able to just select the number before the '-' in acolumn which is formatted like 123-456 so I just need the the 123 part.

Any ideas how this can be achieved?

Thanks.

View 6 Replies View Related







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