String Ending With &

Sep 29, 2005

Hi Kristen:

Thanks for your help in my date problem. It worked perfectly. I was away and could not answer back promptly.

yesterday, i was inserting data from a data file into a SQL table. 1 record had a name field as varchar. But it accidently, ended with a &.
For example, "New Construction &". when I am inserting, its taking all records except this record that ends with a &. Is there any way to include this one Or should I tell my client that this is an error.
If its an error, what is the expalnation(Like string char does not end with a & and & is a ------).
Thanks others in the forum.

View 5 Replies


ADVERTISEMENT

String Ending With &

Sep 30, 2005

I am sorry. "New Construction &". Its not a column name. Its just a record. The table has a column called Name and it accidently, got a record that has "New Construction &" for the Name column.

Its not inserting that record with "New Construction &" in the Name field. Other records are fine.

View 2 Replies View Related

Ending Transactions

Feb 2, 2008

Hi Guys,
Im having trouble stopping a transaction once the result on one or more of my sql statements rolls back the transaction. Take a look at one my first 'IF' statement (below).  If the parameter '@Return' is 'False' i want the transaction rolleback and all sql execution to stop. But my problem is the rest of the sql gets executed and i end up getting rubbish data. Im still new to transactions so i think im doing something really wrong. Please take a look at my sql and help me out in what ever way you think is best. thanks in advance.
MattBEGIN TRY
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
BEGIN TRANSACTION;
BEGIN
DECLARE @Return BIT;
SELECT @Return = (SELECT IsReturnable FROM INVENTORY WHERE InventoryID = 6)
IF (@Return = 'False') ROLLBACK TRANSACTION;
DECLARE @Already_In INT;
SELECT @Already_In = (SELECT ReturnedBy FROM InventoryInUse WHERE (CheckOutNumber = 375))
IF (@Already_In IS NOT NULL) ROLLBACK TRANSACTION;
DECLARE @Outstanding As INT;
SELECT @Outstanding = (SELECT (QtyTaken - 40) AS Outstanding FROM InventoryInUse WHERE (CheckOutNumber = 375));
DECLARE @OutstandingReason As VARCHAR(200);
DECLARE @Get_Person_ID INT;
Select @Get_Person_ID = (SELECT PersonID From [User] WHERE Username = 'matthewsk');
IF (@Outstanding < 0) ROLLBACK TRANSACTION;
ELSE IF (@Outstanding > 0)BEGIN
IF (@OutstandingReason = '') SELECT @RollBack = @RollBack + 1;
UPDATE InventoryInUse SET ReturnedBy = @Get_Person_ID, ReturnDate = GETDATE(), QtyReturned = 40, QtyOutstanding = @Outstanding, WriteOffReason = 'Testing This' WHERE (CheckOutNumber = 375);
UPDATE Inventory SET TotalQty = TotalQty - @Outstanding, QuantityInUse = QuantityInUse - (40 + @Outstanding) WHERE InventoryID = 6;
END;ELSE IF (@Outstanding = 0)
BEGIN
UPDATE InventoryInUse SET ReturnedBy = @Get_Person_ID, ReturnDate = GETDATE(), QtyReturned = 50 WHERE CheckOutNumber = 375;
UPDATE Inventory SET QuantityInUse = QuantityInUse - 50 WHERE InventoryID = 6;
END;
COMMIT TRANSACTION;
END;END TRY
BEGIN CATCH IF (XACT_STATE()) = -1
BEGIN ROLLBACK TRANSACTION;
 
END;
END CATCH;
 

View 3 Replies View Related

Ending A Conversation

Jul 30, 2006

I am attempting to learn Service Broker from Bob Beauchemin's book "A Developer's Guide to SQL Server" - Chapter 11. I'm finding it to be very good but I'm confused over the concept of closing a conversation. Could someone answer the following questions for me?

When a conversation is ended, can the conversation handle that was created when the conversation was created still be used? (I assume not)
Beauchemin says, on page 511, that when a conversation ends, "Any messages still in the queue from the other end of the conversation are deleted with no warning." Does this mean that if I send a message that expects a reply, but I end the conversation, the message is still sent, it is still received by the other endpoint, the other endpoint processes it, but I'll never receive the reply?
Beauchemin says that if no lifetime is specified, the conversation is active for the number of seconds which can be represented by the maximum size of an integer. Does this mean that if I don't specify a lifetime, a conversation is active for many, many years?

Thanks very much.

Amos

View 1 Replies View Related

Microsoft Ending Support For 6.5

Sep 26, 2001

When does Microsoft support for 6.5 end? I am anxious to get rid of my old 6.5s but won't get approval until MS finally pulls the plug.

View 1 Replies View Related

Help!! Eval Period Ending!!!

Aug 29, 2007

Alright here's my situation.
I have two servers both running Eval copies of SQL Server 2005 Enterprise. This is only because I had the promise that I would be getting a shiney new server with a fully licensed copy of the server soon so I wasn't worried when I setup these two programs to use these. Now they are dragging their feet to approve the server and software so I'm scared.
First question - What will happen when the eval period runs out?
Second question - Can I tell what the date was when I installed the server?

These both will help me push management to approve atleast the purchase of an SQL license if I can't get the server.

Thanks.
Rob

View 2 Replies View Related

No Ending Rebuild Master

Dec 30, 2005

I'm using SQL SERVER 2000 and in the process of establishing recoveryguide.Tried to rebuild master using rebuildm.exe but the "Configuring Server"never ending. Then I tried to copy original databases from SQLServerInstallation CD to hard disk as the "Browse for folder", but gave thesame problem. Need advice what need to be done.

View 2 Replies View Related

The Never Ending DTSX Package

May 23, 2006

Hi Champs

I want to implement a rutine that watches for specific files in a specified folder.

I've found the WMI sample "File Watcher Task" for SSIS and it looks fine.

My question is now: how shall I run this package; shall I start it at let it run forever?

And also how do I monitor that the package is running?





Many thanks

Rogvi

View 2 Replies View Related

Ending Multiple Sessions

May 19, 2008

I have a process that seems to leave many orphaned sessions over a period of time. The software is by a 3rd party vendor and they can't seem to fix it. It is safe to end the orphaned sessions and I do that on a regular basis. My questions is: What is the best way to do this via T-SQL?

I can select the orphaned sessions by using a simple query on the sys.dm_exec_sessions table. How do I then run a kill command for each session_id from that query?

I appreciate any info/advice anyone might have!

View 5 Replies View Related

Automate Week Ending Date

Nov 3, 2005

How do i automate, by stored procedure, generating the "week ending" date using a field data.

------------------------------------------------------------

CREATE TABLE [dbo].[t_Work_Hours] (
[WorkHoursID_PK] [int] IDENTITY (1, 1) NOT NULL ,
[PeopleID_FK] [int] NOT NULL ,
[JobID_FK] [int] NULL ,
[StartTime] [datetime] NULL ,
[EndTime] [datetime] NULL ,
[Title] [nvarchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[WeekEnding] [datetime] NULL ,
CONSTRAINT [PK_t_Work_Hours] PRIMARY KEY CLUSTERED
(
[WorkHoursID_PK]
) ON [PRIMARY] ,
CONSTRAINT [FK_t_Work_Hours_t_Work_People] FOREIGN KEY
(
[PeopleID_FK]
) REFERENCES [dbo].[t_Work_People] (
[PeopleID_PK]
)
) ON [PRIMARY]
GO
-------------------------------------------------------

What i have tried has'nt even been close to a solution.
UPDATE dbo.t_Work_Hours
SET WeekEnding = DATETIME ( ??? , StartTime) . I have no idea where to go!

----------------------------------------------------------------
WorkHoursID_PK, PeopleID_FK, JobID_FK, StartTime, EndTime, Title, WeekEnding
7, 40, 3, 11/1/2005 6:00:00 AM, 11/1/2005 4:30:00 PM, J, (NULL)
8, 43, 3, 10/31/2005 6:00:00 AM, 10/31/2005 4:30:00 PM, F, 11/6/2005 11:59:00 PM
9, 43, 3, 11/1/2005 6:00:00 AM, 11/1/2005 4:30:00 PM, F, 11/6/2005 11:59:00 PM
-----------------------------------------------------------

View 3 Replies View Related

Transact SQL :: Finding Ending Inventory Of The Day

Apr 30, 2015

I would like to know how I could code so that I can get the ending inventory of each day.  The following is my data

CREATE TABLE #TEMP
(
DATERCVD DATETIME
,ACCTID INT
,DATESENT DATETIME
)
INSERT INTO #TEMP VALUES ('01/01/2015', 1 , '01/05/2015')

[Code] ....

So my query results should be something like this:

InventoryDate Received Sent Ending
1/1/2015 4 1 3
1/2/2015 5 0 8
1/3/2015 3 2 9
1/4/2015 0 4 5
1/5/2015 0 5 0

TOTAL 12 12

View 5 Replies View Related

Rounding Number With Ending Equals 5

May 30, 2006

Hi,

How do I round when number is ending with 5 for example:

When the number next to number 5 is an even number



24.5 = 24.0 round down

0.245 = .24 round down

1265 = 1260 round down


when the number next to number 5 is an odd number



23.5 = 24.0 round up

0.235 = .24 round up

1755 = 1760 round up


Thanks in advance!

View 5 Replies View Related

Ending A Conversation In A CLR Activated Stored Procedure

Apr 26, 2006

I've read Remus' article on Fire and Forget tactics when it comes to ending conversations, and I have to admit I am guilty of sending a message to a service and immediately ending the conversation. I've set up a stored procedure to end the conversation on the initiator queue, but I'm guessing it's never being fired because I am not ending the conversation in the target activated stored proc, which is a CLR stored proc.

Can you tell me how to end the conversation from a CLR stored proc?

Now that I think of it none of the code I use in my TSQL activated stored procs to handle different message types and error-checking is done in the CLR stored proc.

Thanks

View 5 Replies View Related

How To Aggregate, Preserving Starting/ending Record Ids?

Jun 14, 2007

I have a bunch of records of the following layout:

A B 1235
A B 1236
A B 1237
A C 1238
A C 1239

When I run my script, I want to aggregate these together, but preserve the starting and ending record ids in two new columns:

A B 1235 1237
A C 1238 1239

Can I do all of this in an Aggregate Transformer, or do I need to derive some columns first?

Thanks!

Jim Work

View 10 Replies View Related

SQL Server Agent - Can A Job Be Triggered To Start By Another Job Ending?

Jul 3, 2007

Hi,



I have a job in SQL Server agent with 199 SSIS steps and growing. In the job log only 99 steps are shown, which is a problem if a step higher than 99 fails to run. I need the steps to run in sequence and preferable would like to split the job into several jobs each containing no more than 99 steps. The only thing I don't know is if it is possible to have the next job in sequence start only when the previous job has finished.



Does anyone know if this is possible, and if so how it is done?



Many thanks,



Paul

View 4 Replies View Related

ASP.NET Web Application Ending With Error Before Completion Of Stored Procedure

Feb 17, 2008

Hi,
 I have a simple web application which calls a stored procedure. The stored procedure operates as a transaction and runs for several minutes. I've created a partial class to set the SQLcommand timeout property to avoid any timeouts, which works fine. Unfortunately though, when the application is run in the production environment, it ends in an error after a certain amount of time (maybe a couple of minutes - not exactly sure), which seems to be the same each run. It doesn't appear to end the stored procedure though, which results in locking the tables. It runs fine in the development environment, and it doesn't appear as though any error information is provided when the application crashes.
I'm assuming that the ASP.NET application is timing out for some reason, but the stored procedure itself is fine. I can run it directly from SQL server without any dramas. In the Virtual Directory configuration within IIS, I have the script timeout period set to 1200 seconds. The Default Web-Site timeout property is set to 120 seconds, but I'm assuming that this is only for internet connection timeout, not database transaction timeouts.
Any information as to what may be causing this is appreciated.
Thanks

View 3 Replies View Related

Remotely Ending Service In 2003 To Restore Database

Mar 24, 2008

Morning Guys,
I have a database where I need to kill a remote connection.
If I was manually logged into the box i would you a netstat command to stop the service.
I would like to end a process from another machine before starting a restore process

Does anyone have any suggestions?

thanks,
Jonathan

View 3 Replies View Related

Using Password Ending In Unmatched Double Quote Mark With OleDbConnection

Mar 14, 2008


Issue



I need to write VS2005 C# code using SQL OLE DB to access SQL Server 2005. I have no choice in that matter. I can create a database user with a password like COMPANY", which is a string of uppercase characters ending in an unmatched double-quote mark.

Using Microsoft SQL Server Server Management Studio I login using Windows Authentication, create an account with the password, COMPANY", check the "Enforce password policy", click "OK", and then exit.


Setup


I launch Microsoft SQL Server Server Management Studio again, select "SQL Server Authentication", type in the account name and the COMPANY" password, click the Connect button, and I'm in.

Problem


Now, I need to connect programmatically and run a stored procedure. The password is stored in clear text in hte Registry€”not my choice, it's a legacy application, and changing that is not an option open to me. (We have probably all seen company safes where the combination is scribbled on the wall in case you forget it!)

Here is the code I use to run the sproc:


DBCONNINFOLib.DBConnectionInfoClass DBConnInfo1 = new DBCONNINFOLib.DBConnectionInfoClass();
String strConnString = DBConnInfo1.GetConnectionString( "" );
OleDbConnection con1 = new OleDbConnection( strConnString );
OleDbCommand cmd1 = con1.CreateCommand();
cmd1.CommandType = CommandType.StoredProcedure;
String sCmdText = "sp_SomeStoredProcedure";
cmd1.CommandText = sCmdText;

If I set the connection string in the registry to COMPANY", I get an error like this:


Server Error in '/' Application.


Response is not available in this context.
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.

Exception Details: System.Web.HttpException: Response is not available in this context.

Source Error:





Line 60: catch (System.Exception e)
Line 61: {
Line 62: Response.Write(e.Message.ToString());
Line 63: }
Line 64:
Source File: C:sourceProductNameDataCenterAdm&ReportsWebPagesProductNameWebCommonCodeCommon.cs Line: 62

Stack Trace:





[HttpException (0x80004005): Response is not available in this context.]
System.Web.UI.Page.get_Response() +2077605
SiteIQWeb.CommonCode.Common..ctor() in C:ProductNameDataCenterAdm&ReportsWebPagesProductNameWebCommonCodeCommon.cs:62
SiteIQWeb.MasterPage..ctor() in C:ProductNameDataCenterAdm&ReportsWebPagesProductNameWebMasterPage.master.cs:21
ASP.masterpage_master..ctor() in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
oot255b545c8a400c7App_Web_hfj8popy.0.cs:0
__ASP.FastObjectFactory_app_web_hfj8popy.Create_ASP_masterpage_master() in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
oot255b545c8a400c7App_Web_hfj8popy.3.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +49
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +250
System.Web.UI.Page.get_Master() +48
System.Web.UI.Page.ApplyMasterPage() +18
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +685




Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433


The closes to success I have been able to come is to set the password to "COMPANYNAME""" or 'COMPANYNAME"', which results in a System.Data.OleDb.OleDbConection Exception with a HResult of 0x80040e4d, and the message Login failed for user 'username'.


Questions


Can the password be formatted differently in the registry, or somehow processed after retrieving it, so that SQL Server 2005 will accept it?

Is this a bug in .NET Framework or SQL OleDb?

Is this simply a case of "Is it hurts, don't do it"?

Thanks in advance. As with all postings, my job, promotion, product success, company future, or some combination thereof is on the line.

View 2 Replies View Related

Transact SQL :: Create Table Named With Ending Date-time Format

Jun 25, 2015

what would be the TSQL in trying to create a new table with date-time format ending via a select into like:

select
*
into tblResults_
+
SELECT
CONVERT(VARCHAR(10),GETDATE(),112)
+
'_'
+
REPLACE(CONVERT(VARCHAR(10),GETDATE(),108),':','_')
from qryResult

View 3 Replies View Related

SQL Server 2008 :: Long Text Field - Failed To Locate Ending Boundary Of A Sentence

Apr 23, 2015

I have an very long ntext field, made up of many sentences that I append a full stop to every one, I also strip out any line breaks within the text. However I get this error, when I look it up it comes up with "Failed to locate the ending boundary of a sentence."

View 0 Replies View Related

SQL Server 2008 :: Get Week Ending Date Given Week Number

Apr 9, 2013

How can I get Saturday's date given the week number?

This is my week number, SELECT DATEPART(WEEK, DATEADD(MONTH, +3, ApptDt2)). I need to get Saturday's date from this week.

View 9 Replies View Related

How To Get Starting Datetime(monday) Of The Week And Ending Datetime Of The Week(sunday)

May 2, 2007

hi friends,



how to get the date of the first/last day of the week in sql...

can any one help me





Cheers,

raj

View 5 Replies View Related

SQL Server 2008 :: Search Each And Every String In Comma Delimited String Input (AND Condition)

Mar 10, 2015

I have a scenario where in I need to use a comma delimited string as input. And search the tables with each and every string in the comma delimited string.

Example:
DECLARE @StrInput NVARCHAR(2000) = '.NET,Java, Python'

SELECT * FROM TABLE WHERE titleName = '.NET' AND titleName='java' AND titleName = 'Python'

As shown in the example above I need to take the comma delimited string as input and search each individual string like in the select statement.

View 3 Replies View Related

SQL Server 2012 :: Finding Longest String Within A String Field

Mar 20, 2014

We have some URLs within a bulk block of text some of which are very long. I need to identify rows where such urls exceed say 100 characters in length in amongst other text.So the rule would be return a record if within the string there is a string (without spaces) longer than 100 characters.

View 9 Replies View Related

SQL Server 2014 :: Find String With Spaces And Replace Them With Other String

Sep 8, 2015

I have following query which return me SP/Views and Functions script using:

select DEFINITION FROM .SYS.SQL_MODULESNow, the result looks like
Create proc
create procedure
create proc
create view
create function

I need its result as:

Alter Procedure
Alter Procedure
Alter Procedure
Alter View
Alter Function

I used following

select replace(replace(replace(DEFINITION,'CREATE PROCEDURE','Alter Procedure'), 'create proc','Alter Procedure'),'create view','Alter View') FROM .SYS.SQL_MODULESto but it is checking fixed space like create<space>proc, how can i check if there are two or more spaces in between create view or create proc or create function, it should replace as i want?

View 5 Replies View Related

String Or Binary Data Would Be Truncated. (only For 1700 Character String?)

Nov 2, 2006

I am trying to insert a row into a table of Microsoft SQL Server 2000.

There are various columns.















[SNO] [numeric](3, 0) NOT NULL ,
[DATT] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
,
[DATTA] [char] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
,
[CODECS] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
,

The [DATTA] column is causing a problem. Even if I am trying to put only 1700 character string into [DATTA], the java code throws the following exception:-



StaleConnecti A CONM7007I: Mapping the following
SQLException, with ErrorCode 0 and SQLState 08S01, to a
StaleConnectionException: java.sql.SQLException: [Microsoft][SQLServer 2000
Driver for JDBC]Connection reset

      at
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)


Why is it throwing an exception even though the sum-total of this row doesn't exceed 8000 characters?

Can anyone please tell me what's wrong?

View 6 Replies View Related

Help: About Ms Sql Query, How Can I Check If A Part String Exists In A String?

May 22, 2007

Hello to all,
I have a problem with ms sql query. I hope that somebody can help me. 
i have a table "Relationships". There are two Fields (IDMember und RelationshipIDs) in this table. IDMember is the Owner ID (type: integer) und RelationshipIDs saves all partners of this Owner ( type: varchar(1000)).  Example Datas for Table Relationships:                               IDMember     Relationships              .
                                                                                                                3387            (2345, 2388,4567,....)
                                                                                                                4567           (8990, 7865, 3387...)
i wirte a query to check if there is Relationship between two members.
Query: 
Declare @IDM int; Declare @IDO int; Set @IDM = 3387, @IDO = 4567;
select *
from Relationship where (IDMember = @IDM) and ( cast(@ID0 as char(100)) in
(select Relationship .[RelationshipIDs] from Relationship where IDMember = @IDM))
 
But I get nothing by this query.
Can Someone tell me where is the problem? Thanks
 
Best Regards
Pinsha

View 9 Replies View Related

Adding String To Database, But Name Of String Is Added, Not Data

Mar 12, 2008

Hello, I am tring to add a string my database.  Info is added, but it is the name of the string, not the data contained within.  What am I doing wrong?  The text "Company" and "currentUserID" is showing up in my database, but I need the info contained within the string.  All help is appreciated!
 
 
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClientPartial Class _DefaultInherits System.Web.UI.Page
 
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
'Database ConnectionDim con As New SqlConnection("Data Source = .SQLExpress;integrated security=true;attachdbfilename=|DataDirectory|ASPNETDB.mdf;user instance=true")
'First Command DataDim Company As String = ((CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Company"), TextBox)).Text)
Dim insertSQL1 As StringDim currentUserID As String = ((CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"), TextBox)).Text)
insertSQL1 = "INSERT INTO Company (CompanyName, UserID) VALUES ('Company', 'currentUserID')"Dim cmd1 As New SqlCommand(insertSQL1, con)
'2nd Command Data
Dim selectSQL As String
selectSQL = "SELECT companyKey FROM Company WHERE UserID = 'currentUserID'"Dim cmd2 As New SqlCommand(selectSQL, con)
Dim reader As SqlDataReader
'3rd Command Data
Dim insertSQL2 As String
insertSQL2 = "INSERT INTO Company_Membership (CompanyKey, UserID) VALUES ('CompanyKey', 'currentUserID')"Dim cmd3 As New SqlCommand(insertSQL2, con)
'First CommandDim added As Integer = 0
Try
con.Open()
added = cmd1.ExecuteNonQuery()
lblResults.Text = added.ToString() & " records inserted."Catch err As Exception
lblResults.Text = "Error inserting record."
lblResults.Text &= err.Message
Finally
con.Close()
End Try
'2nd Command
Try
con.Open()
reader = cmd2.ExecuteReader()Do While reader.Read()
Dim CompanyKey = reader("CompanyKey").ToString()
Loop
reader.Close()Catch err As Exception
lbl1Results.Text = "Error selecting record."
lbl1Results.Text &= err.Message
Finally
con.Close()
End Try
'3rd Command
Try
con.Open()
added = cmd3.ExecuteNonQuery()
lbl2Results.Text = added.ToString() & " records inserted."Catch err As Exception
lbl2Results.Text = "Error inserting record."
lbl2Results.Text &= err.Message
Finally
con.Close()End Try
 
 
 End Sub
End Class

View 3 Replies View Related

SQL 2012 :: Eliminate Characters From A String Based On Another String?

Dec 17, 2014

I have a string 'ACDIPFJZ'

In my table one of the column has data like

PFAG
ABCDEFHJMPUYZ
KML
JC
RPF

My requirement is that if the string in the column has any of the characters from 'ACDIPFJZ' , those characters have to be retained and the rest of the characters have to be removed.

My output should be:

PFAG -- PFA (G Eliminated)
ABCDEFHJMPUYZ -- ACDPFJZ (B,E,H,M,U,Y Eliminated)
KML -- No data
JC -- JC
RPF -- PF (R Eliminated)

View 2 Replies View Related

SQL 2012 :: Picking Number String Out Of Text String

Jul 14, 2015

I have a text field which has entries of variable length of the form:

"house:app.apx&resultid=1234,clientip"
or
"tost:app.apx&resultid=123,clientip"
or
"airplane:app.apx&resultid=123489,clientip"

I'm trying to pick out the numbers between resultid='...',clientip no matter what the rest of the string looks like. So in this example it would be the numbers:

1234
123
12389

the part of the string of the form resultid='...',clientip always stays the same except the length of the number can vary.

View 5 Replies View Related

Need Help With String Manipulation - Splitting 1 String Into Multiple Columns

Sep 11, 2006

Hello All,

I'm a non-programmer and an SQL newbie. I'm trying to create a printer usage report using LogParser and SQL database. I managed to export data from the print server's event log into a table in an SQL2005 database.

There are 3 main columns in the table (PrintJob) - Server (the print server name), TimeWritten (timestamp of each print job), String (eventlog message containing all the info I need). My problem is I need to split the String column which is a varchar(255) delimited by | (pipe). Example:

2|Microsoft Word - ราย�ารรับ.doc|Sukanlaya|HMb1_SD_LJ2420|IP_192.10.1.53|82720|1

The first value is the job number, which I don't need. The second value is the printed document name. The third value is the owner of the printed document. The fourth value is the printer name. The fifth value is the printer port, which I don't need. The sixth value is the size in bytes of the printed document, which I don't need. The seventh value is the number of page(s) printed.

How I can copy data in this table (PrintJob) into another table (PrinterUsage) and split the String column into 4 columns (Document, Owner, Printer, Pages) along with the Server and TimeWritten columns in the destination table?

In Excel, I would use combination of FIND(text_to_be_found, within_text, start_num) and MID(text, start_num, num_char). But CHARINDEX() in T-SQL only starts from the beginning of the string, right? I've been looking at some of the user-defind-function's and I can't find anything like Excel's FIND().

Or if anyone can think of a better "native" way to do this in T-SQL, I've be very grateful for the help or suggestion.

Thanks a bunch in advance,

Chutikorn

View 2 Replies View Related

Transact SQL :: Search And Return String After Searched String

Sep 1, 2015

Is there way to search for the particular string and return the string after that searched string

SalesID
Rejection reason
21812

[code]....

The timeout period elapsed hence disqualified

View 3 Replies View Related

Find In String And Return Part Of String

Mar 21, 2007

I am trying to find a way to find a certian character in a string and then select everything after that character.

for example i would look for the position of the underscore and then need to return everthing after it so in this case

yes_no

i would return no

View 7 Replies View Related







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