How To Use Substring With Starting Point?

Apr 11, 2005

Hi all,

I want to select a column which is store email address. How to use the substring function from starting point '@' to end of string?

Here is my syntax :

select substring(emailaddress, [what syntax] ,len(emailaddress)) from table

Thanks!

View 2 Replies


ADVERTISEMENT

Good Starting Point?

Jul 5, 2007

What's a good starting point to learning the native c++ OLEDB structure for accessing SQL Server Compact databases? I see several links into the msdn library, but the library seems to hold a ton of links with little to no actual content. I just need to learn how to do the basics...open a database and run simple queries (select, insert, and update). The examples look incredibly convoluted and don't seem to make sense.

I will be developing for a console program in windows ce 5 on VS2005 if that helps, so I don't need all the windows gui code.

Thanks!

View 5 Replies View Related

Generate Values Between A Starting And Stopping Point (time Values).

Apr 23, 2007

[RS 2005]

Given the starting and stopping points (time values), how do I generate values between these points.

For example, if I have 08 (representing Hour) as a starting point and 12 as a stopping point.

From this I would like to generate a data sequence like 08, 09, 10, 11, and 12.

So how do I accomplish this? In SQL or in the RS?

The only thing I can think of is using a WHILE loop and a temporary table in SQL (not to keen on doing this).



//HÃ¥kan

View 7 Replies View Related

I Had Set My Windows Service's Startup Type As Automatic But It Is Not Starting Up Automatically When The System Is Starting.

May 18, 2007

Hello,



I had created a windows service using C#. I set its Startup Type as Automatic but it is not getting started automatically when my System Starts.

View 3 Replies View Related

Is Point In Time Recovery To A Point Before The Last Full Database Backup Possible?

Mar 26, 2008

Hello all,

First off, I appreciate the time that those of you reading and responding to this request are offering. My quesiton is a theoretical and hopefully simple one, and yet I have been unable to find an answer to it on other searches or sources.

Here's the situation. I am working with SQL Server 2005 on a Windows Server 2003 machine. I have a series of databases, all of which are in Full recovery mode, using a backup device for the full database backups and a separate device for the log backups. The full backups are run every four days during non-business hours. The log backups are run every half hour.

Last week, one of my coworkers found that some rarely-used data was unavailable, and wanted to restore a database to a point in time where the data was available. He told me that point in time was some time back in November.

To accomplish this, I restored the database (in a separate database, as to not overwrite my production database) using the Point in Time Recovery option. I selected November from the "To a point in time" window (I should note that this window is always grey, never white like most active windows, it seems), and the full database backup and the subsequent logs all became available in the "Select the backup sets to restore" window.

I then tried a bevy of different options from the "Options" screen. However, every restore succeeds (ie: it doesn't error out), but seems to be bringing the database back to a current point in time. It's never actually going back to the point in time I specify.

My questions are as follows:

a) Is it possible to do a point in time recovery to a point in time BEFORE the last full database backup?

b) If so, what options would you recommend I use? (ie: "Overwrite the existing database", restore with recovery, etc etc).

I again appreciate any and all advice I receive, and I look forward to hearing from anyone and everyone on this topic. Thank you.

Ryan

View 4 Replies View Related

Difference In Starting Rep Service Vs. Stopping And Starting The Rep Job?

Feb 1, 2007

When our rep distribution services time-out (several times a day) some dba's just restart the service while others restart the rep job which starts the service. Are there any differences between these two methods? Does restarting the service inherit any changes made to the job's attributes?



Thanks!

View 1 Replies View Related

SQL Agent Is In Starting Status - But Not Starting

Mar 6, 2002

We have SQL 2000 (SP2) , Our SQL server agent showing green light as started from EM , It is succussfully restarting from NT Services too . But When I open the properties of the jobs from EM its gives error message SQL DMO error " SQl Agent is starting , try later " . And in EM Next run Date & Time not available .

MDDB database is accessable & in Log file its recovered fully

Thankx in Advance

Sha

View 1 Replies View Related

SQL Server Over Point-to-Point T1

Nov 10, 2006

I'm running SQL Server 2005 on a Server 2003 machine serving both our home network as well as a remote site through a point-to-point T1. While file transfer speeds are up to par, the remote site's interaction with SQL Server (Point of sale system) is very slow. After testing I am certain that it has nothing to do with the actual physical machine in place neither is it an issue with the program itself since speeds are as they are supposed to be over the home network lan. It seems that there might be a packet size issue or something of the sort. Has anyone dealt with this before or have any thoughts?

Thanks,
Peter

View 7 Replies View Related

Substring

Jul 5, 2001

Hi all,
I have just started using SQL7 and quite dumb at it.
Here is my problem

i have tables ip_address and ip_subnets. both contains more than 20,000 records. Though ideally each subnet should correspond to only one ip address it is not so due to SMS inventory and remote clients configurations etc.

As an example If my ip address is 141.151.128.78 I need to select only 141.151.128.64 ( or atleast 141.151.128.*)as the valid subnet. In other words I need to compare upto 3rd octet and only if it matches with ip address then declare that as the valid subnet.
Pls note that ip addresses vary for each machine though there will 4 octets, I can't use character positions as the nos in each octet might vary from 1-255.

Any help would be greatly appreciated
Pasted here under is the query script I am playing around with charcter poistions which are not working in my favor. Just added to explain my problems in more clearer way
select distinct system_data.name0, System_IP_Address_ARR.ip_addresses0, System_IP_subnets_Arr.ip_subnets0, system_disc.client0 from system_Data, System_IP_Address_ARR, system_ip_subnets_arr, system_disc where system_data.machineid = System_IP_Address_ARR.itemkey and system_data.machineid = system_ip_subnets_arr.itemkey and system_data.machineid = system_disc.itemkey and system_disc.client0 = 1 and substring(System_IP_Address_ARR.ip_addresses0,1,10 ) = substring(System_IP_subnets_ARR.ip_subnets0,1,10) and substring(System_IP_Address_ARR.ip_addresses0,10,1 ) = '.' and System_IP_subnets_ARR.ip_subnets0 not in ('11%.%.%.%','12%.%.%.%', '10%.%.%.%' , '10.%.%.%' , '1.%.%.%') order by System_DATA.name0


Arun

View 2 Replies View Related

Need Help On Substring

Nov 5, 2001

Hey you sql programming guru's

I need help seperating a name from first name and last name

The field is like this,

last name, first name
example Doe, John
I need to seperate the last name from the , to the first character
and the last name from the , to the last character.

I think I have to use a substring but not sure how tell it to stop and
start when it gets to the comma.

Can someone please help me.

Thanks,
Dianne

View 1 Replies View Related

SubString

Aug 8, 2001

Need to do something like SUBSSTRING in Access, any ideas?

View 1 Replies View Related

Using Substring

Oct 4, 2004

Hi

Can anyone show me how to do the following:

I have this snippet of data

ids
-----------------------------------
1582270|1582277
1582270|1582277|1582286
1582270

I want to return the id (the id may not always have the same number of numbers) after the last pipe (|) delimter.

So i want a rs like this :
ids
-----------------------------------
1582277
1582286
1582270


Thanks in advance

View 9 Replies View Related

Substring Help

Feb 4, 2005

Hi,
please help me in developing query to satisfy this...
i have table called test and the table data looks like this.

col1
123.abc
1.ab
12.cba

the query needs to return all rows data after . the result set should return this

abc
ab
cba

appreciate your help..
thanks
sskris

View 1 Replies View Related

Substring

Feb 3, 2004

I have a field that contaings 15 characters. I want to just pull the first 6. So anything that matches these 6 will be returned.

View 10 Replies View Related

Substring???

Apr 8, 2004

We have entries like below in a table. I need a query by which I can get the CustomerName from the below entries.


ACustomerName
ACustomerNameCredit
ACustomerNameDebit

Thanks!

View 14 Replies View Related

Substring

Jun 2, 2004

I an trying gto devide this one field that contains city state and zip into 3 seperate columns. The Column right now looks like this:

Coulumn1
-------------------------------
SOUTH EL MONTE CA91733617
BOSSIER LA71172
GARDENA CA90249107
MILWAUKEE WI53216
PARIS IL61944
DUQUOIN IL62832
REDWOOD FALLS MN56283
AUBURN ME04210


I tryed this:

use cimpro1
select substring(cust_shipto_addr_l3, 1, 19) as 'City',
substring(cust_shipto_addr_l3, 20, 21) as 'State',
substring (cust_shipto_addr_l3, 22, 31) as 'Zip'
from opcshto


For some reason, when I run the query I get this for State:

State
-------------------------
CA91733617
LA71172
CA90249107
WI53216
IL61944
IL62832
MN56283
ME04210


When I use the substring to only pull characters 20 and 21 it pulls everything startign at 20. I just want it to select character position 20 ans 21 for the state. As far as the substring for City and Zip, everything comes out fine. Its just State that I am having trouble with.

Any help is appreciated.

View 7 Replies View Related

Substring

Sep 13, 2006

iam trying to write a string function which will give me the id part of a mail id
but iam geting the string along with @ and when iam trying to remove the last char (@) iam getting error

query:
select substring(leadassignedtombemail,1,(CHARINDEX('@', leadassignedtombemail)))
from lead_details -----> Gives me id along with @


select substring(leadassignedtombemail,1,(CHARINDEX('@', leadassignedtombemail) - 1))
from lead_details ------------>gives me error "Invalid length parameter passed to the substring function."

But
select (CHARINDEX('@', leadassignedtombemail) - 1) from lead_details
works and gives me the length of id without counting @

where did i go wrong

View 2 Replies View Related

Help With Substring

Dec 1, 2006

i am trying to get the last name of the customer, but my db has the names stored as (first,middle, last) order in a single field. i am using the statment:
,RIGHT(ActCustName,LEN(ActCustName) - CHARINDEX(' ',ActCustName) ) AS LAST

but it only works if the customer does not have a middle name, otherwise it returs the middle+last as the last name. what should i do/ any ideas??? here is my code

select ActPrjMgr
,ActEmpId
,ActEmpName
,ActCustName
,RIGHT(ActCustName,LEN(ActCustName) - CHARINDEX(' ',ActCustName) ) AS LAST
,ActPrjCode
,left(ActPrjType,2) as Status
,ActEmpTaskCode
,left(ActBillingPeriod,11)as ppedate
,left(ActivityDate,11) as actdate
,ActTimevalue
from dbo.ACTIVITIES
where ActBudCat = 'labor'
and ActBillingPeriod = '11/17/2006'
and actprjcode <> ' '
and actprjcode is not null
--and ActBillingPeriod = @StartDate
order by ActPrjMgr
,ActEmpID
,ActEmpTaskCode
,ActivityDate

View 7 Replies View Related

Substring

Mar 19, 2007

Hi All

Iam new to sql, Iam using sql 2000 and have a field datatype varchar.

An example of the string: -

CN=Leighton Morgan/OU=WR/O=Extranet

I need to write a query that will allow me to extract the following:-

Name: Leighton Morgan
Company: WR
and lastly the word Extranet

Please can you help

Many Thanks

View 9 Replies View Related

Substring

Mar 19, 2007

Hi All

Iam new to sql, Iam using sql 2000 and have a field datatype varchar.

An example of the string: -

CN=Leighton Morgan/OU=WR/O=Extranet

I need to write a query that will allow me to extract the following:-

Name: Leighton Morgan
Company: WR
and lastly the word Extranet

Please can you help

Many Thanks

View 1 Replies View Related

Substring

Mar 19, 2007

Hi All

Iam new to sql, Iam using sql 2000 and have a field datatype varchar.

An example of the string: -

CN=Leighton Morgan/OU=WR/O=Extranet

I need to write a query that will allow me to extract the following:-

Name: Leighton Morgan
Company: WR
and lastly the word Extranet

Please can you help

Many Thanks

View 1 Replies View Related

Substring

Jan 25, 2006

i have a column that has "Full name" of an individual.

I want to create a new column with just the first name.

How do i populate this column with just the first name...ie it just takes the string until the space from the "full name" column.

View 5 Replies View Related

Substring

Oct 22, 2007

can anyone help me with the following report.

Create procedure Rpt_StaffDevelopmentReport
(@cmb1 as varchar(100),
@cmb2 as varchar(100) with encryption as

Begin
--@cmb1 is the site name (s.sitename), @cmb2 is the staffname in the form €˜surname,forename€™

--@cmb2 will need to be split based on the €˜,€™ within the string
--tables needed are staffDevelopment , staffMember and Site
end


Three Tables.

Site
Columns
Siteid, sitename, address1, address2

Staffmember
Staffed, surname, forename,sex, address1, address2, siteid

Staffdevelopment
Staffed, development, personal

View 7 Replies View Related

Substring Problem

Feb 1, 2007

Hi
 
In  my status table I m having field like
Actionby (COLUMN NAME)
-------------------
TravelDept
TravelDept
Approver
FinanceDept
TravelDept(xyz@yahoo.com)
 
I m having mail id along with TravelDept in some rows.
I want to retreive rows containing TravelDept.When i am retreving i wnat to retreive value 'TravelDept' which is having mail id also.
i have written one query,but its retreving only the value which is having mail id.
i want to retreive TravelDept value with mail id and Only TravelDept values also.
my query is:
select replace(SUBSTRING(S.Actionby,CHARINDEX('',S.Actionby,1) , CHARINDEX('(',S.Actionby,1)+0 ),')', '')  from status S;
But this query retreiving only 1 row only insteadof 3 rows.
Total 3  rows having TravelDept value.I want to retreive all these 3 rows.
please help me.
 
Thanks.
 
 

View 2 Replies View Related

Substring Sql Statement

Aug 31, 2007

I have a SQL column that contains something like this:






ORLANDO        ,FL.    32803

COCOA       , FL. 32922-8617

SATELLITE BCH,FL  32937-3523

TAMPA       , FL. 33609-3105

EAU GALLIE      ,FL.   32935
I need only the name of the city, dont need FL or the zip code, how can I do a substring statement on sql to get only that?
Thanks,
Erick

View 8 Replies View Related

Can You Use Substring In ASP.NET On A DropDownList ?

Oct 26, 2007

I'm using the GridView to display some accounting infromation. I have a project where I have a 14 character control number. I would like to have a dropdown list to select the account classification of records to be displayed. The accounting classification is the first two characters of the control number.  So the dropdown list needs to show unique first two characters and the GridView will be filtered on these two characters.  I have been trying to use "substring" in the ASP.NET code; not even sure you can.
Any suggestions on how to accomplish this would be greatly appreciated.  See code below:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="control_num" DataValueField="control_num">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:GPCRReportsConnectionString %>"
SelectCommand="SELECT DISTINCT [substring(control_num,1,2)] FROM [Request]"></asp:SqlDataSource>
ERROR: Invalid column name 'substring(control_num,1,2)'.

View 6 Replies View Related

T-SQL SUBSTRING For RequestDateTime

Dec 11, 2007

I tried to mimic some code I found but on RequestDateTimeSUBSTRING(RequestDateTime,(charindex(':',RequestDateTime)+1),len(RequestDateTime)) AS 'Date Downloaded'I can only use SUBSTRING on char type strings.How would I get maybe only up to the first : character in the RequestDateTime? 

View 2 Replies View Related

Substring(very Very Urgent)

May 6, 2008

 hi frenz:
Can any one send me the code for
substring multiple cell values of same column and put it into one cell of that column.

View 3 Replies View Related

Updating A Substring

May 29, 2008

 Hi I am trying to update a part of a date string using the following sql statement. Alas, I'm having no joy.cmd.CommandText = "UPDATE tb_bookings SET SUBSTRING(startDate,12,5) = @newStartTime  WHERE requestPackID = @reqPackID";   The date has been saved  in the db in the following format:Fri May 23 17:30:00 GMT+0900 2008 Any idea why this isn't working. Any help much appreciated.Barry 

View 4 Replies View Related

SQL Substring Syntax

Jan 28, 2006

Hi,
I'm trying to do write a query in SQL that returns the last two characters in a field.
If the actual fields are sheep, dog, cat, parrot
I want the query to return ep, og, at, ot
After rooting around I've discovered the SQL 'substring' function.
The problem I have is that the field has a variable length, so I need a way of passing the strign length to substring.
Its probably simple to solve, but not for a rookie like me without an example and I am (as always) grateful for any ideas. 

View 3 Replies View Related

To CARMI & JUN (Substring)

Apr 11, 2002

Hi Carmi & Jun,

Thanks for responding. The problem is still persistent. What I want to do is to display two names in a combobox and the box should only be as wide as 2 adjacent names for their actual length. Whether I use char or varchar the combobox is always twice the width defined for the fields. So we will try to find a solution: an elegant one rather than a workaround.
Any new ideas are still welcome.

Thanks again.

Dirk

View 2 Replies View Related

Substring, Charindex, ??

Feb 18, 2000

I am looking for a way to return only the numbers from the following example:

Column1 varchar(255)

Column1
---------------------
10 rows copied.
55004 rows copied.
1000004 rows copied.

Once I get the numbers I will then convert (Cast) them as Int.

Thank you in advance,
tw

View 1 Replies View Related

Charindex And Substring

May 26, 2005

Hi All,

I have an address field that has data that needs to parsed. The data has different formats. I have tried charindex and substring but I am not getting the results I need.

Here is what the data looks like:

Paper Mill Rd 3332
Allegheny Ave 13 1/2
Balto Nat'l Pike 6600 R-2
Rolling Rd N 3030


Here is the results I am looking for:

street dir street number street name street type street unit
3332 Paper Mill Rd
13 1/2 Allegheny Ave
6600 Balto Nat'l Pike R-2
N 3030 Rolling Rd

Can you help? Thanks.

View 5 Replies View Related







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