How To Drop Intro Char In A String?

Nov 21, 2007

Hi guys,


From my DTS is like this:

DTSDestination("Tex") = replace(DTSSource("Tex"),Chr(13) & Chr(10), "<br>")

And now I try unsuccesfully this one on a Derived Column task

REPLACE([Tex], Chr(13), " " )

TIA

View 1 Replies


ADVERTISEMENT

Replace Char At End Of String

Mar 2, 2000

Hi,

I have a table where this one column(varchar) has rows of data with a period at the end of the string. Is there any function I could use to remove all the periods?

For eg:
bhjio.
shtpl.

should become:
bhjio
shtpl

Thanks

View 1 Replies View Related

Char Count In String

Jul 31, 2013

I have a string like aaannbbghtgggbbaa, I want a query to get count of characters in string like :

a 5
b 4
others 20

View 3 Replies View Related

Search Char In String

Jan 11, 2006

Hi

Is there any function to seperate a sting (VARCHAR) into two based on a character in the string (e.g. '-').

In short is there "InStr" or "split" type function in T-SQL ? If not what is the alternative?

I have a column called "Range" (VarChar) in the table which has ranges like 1-14 or 15-49 etc.

I need to select records by compare a variable (numeric) against these ranges.  

So for instace if the variable has 15 its in range 15-49.

I was thinking of spliting the range field into two so that comparison is possible.

Any suggestions?

thanks

 

 

 

View 5 Replies View Related

How To Compare Nvarchar(15), Char(5), And String

Jan 31, 2008

I have used a query statement with the following WHERE string to 'Fill'  a dataset.  
"AND (A.ApptsDate > '" & strApptPreDate & "' OR (A.ApptsDate = '" & strApptPreDate & "' AND A.ApptsTime >= '" & strApptPreTime & "' ))" & _ and strApptPreTime is defined as:Dim strApptPreTime As String = SomaShared.strPadTime(CStr(dApptCalcNewDate.Hour) + ":" + CStr(dApptCalcNewDate.Minute))
 
Somehow, the dataset showed only the ApptsTime after 10 am.  After more than 2 weeks of debugging, I still can see a dataset watch for > 10 amAppsTime only.   Now I am guessting, the problem is 9 is different from 10 - 16, it all because 9 is single digit.  Then I check the data type settings for these variables.  Here are what I found:
In SQL Server Agent job, the ApptsTime data was 'inserted' by @NewApptTimes, which is declared as char(5).In SQL Server database, the ApptsTime was defined as nvarchar(15).
My question are:     1. The reason why there were no 9 am data for the dataset, is becasue 9 am of nvarchar(15) is not > 8:30 of strApptPreTime?     2. If the answer to the quation 1 is yes, how do I define AppsTime and/or strApptPreTime?
 TIA,Jeffrey 

View 6 Replies View Related

Change Char String To A Date?

Oct 12, 2013

To change string '24.04.2013' (Apr. 24, 2013 format of dd-mm-yyyy) into a date in format of mm-dd-yyyy, what's the easiest way?

View 5 Replies View Related

Turn Hex Into Char String And Concatenate

Feb 16, 2006

I've been trying to return hex data in a way that can be concatenated.
I need the actual hex info (e.g. 0x6E3C070) as displayed
since it contains info about the path to a file.
So I can turn it into D:6E3C7 to get the path to the file.
In searching around I have come across a way to do this but can't figure out how to get it to run through a column and either display or insert into a table multiple results.

-Here's the user function that converts an integer into a hex string-

CREATE FUNCTION udf_hex_string (@i int)
RETURNS varchar(30) AS
BEGIN
DECLARE @vb varbinary(8)
SET @vb = CONVERT(varbinary(8),@i)
DECLARE @hx varchar(30)
EXEC master..xp_varbintohexstr @vb, @hx OUT
RETURN @hx
END
GO


-Using this table-

create table
XPages
(PageStoreId int null,
HexString varchar (30) null,
VolumePath varchar (60) null, )


--'PageStoreId' contains the data that needs to be converted into the editable hex string
--'HexString' is where I'd like it to go so I can parse it later.

--I can run the below select and get the hex string. But am stuck on how to run a select or update that would run through the 'XPages.PagestoreId'
column and insert the hex string into the 'XPages.Hexstring' column. 'XPages.PagestoreId' could have 100's of entries that need to be converted and placed in the relevant the 'XPages.Hexstring' column.


SELECT dbo.udf_hex_string(1234)



Thanks

View 3 Replies View Related

Built In Function To Search The Occurence Of Char In String

Jan 10, 2008



Hi Everyone-
i woder if someone know Built in function to search the occurence of char in string in T-SQL

and iam not talking about the Index of the first occurence (e.g CHARINDEX )
but it is more generic

i want to send to the function to ask about the index the second or the third or N occurence of the char.
and i wonder if it is built in for performance reasons

example
getseachIndex("M|d|d","|",2)==> the result is 4

View 3 Replies View Related

What Is The Difference Between Updating Null Value Vs Empty String To Varchar/char Field?

Aug 29, 2007

Hi,
What is the difference updating a null value to char/varchar type column

versus empty string to char/varchar type column?Which is the best to do and why?
Could anyone explain about this?

Example:

Table 1 : tCountry - Name varchar(80) nullable
Table 2 :tState - Name char(2) nullable
Table 3 :tCountryDetails - countryid,state (char(2) nullable) - May the country contain state or no state
So,when the state is not present for the country ,i have two options may be - null,''
tCountryDetails.State = '' or tCountryDetails.State = null?

View 9 Replies View Related

Intro To News

Dec 16, 2004

Hi!

I want to show intro of the newest news on my startpage. But I only would like to show the subject and part of the message and if you klick on the subject you can se the whole news...how can I do that?

I have an mySQL database with the news.

I havn't found any thread with this topic...

Zäta

View 3 Replies View Related

Intro To SQL Server

Jul 10, 1998

I am being moved to a group whose applications use SQL server quite extensively (apparently). I have never used SQL server, however I have (at school) taken an SQL course in DB2. I`m interested in seeing if anyone has any recommendations for a good book I could read at an introduction level on SQL server. I`m not sure what version they`re using but I would assume it`s fairly current. Besides, I`m not looking for version-specific information. Can anyone help me out with some references? Thank you in advance.

View 1 Replies View Related

A Few Intro SQL Questions

Feb 25, 2008

I installed what I thought was the trial version for SQL 2005 server. How do I check how much time is remaining on my trial, or if I'm even running a trial version at all?

Thanks

View 5 Replies View Related

Intro To Oracle 9i: SQL Scripts

Mar 24, 2005

I am currently reading the Intro to Oracle 9i: SQL course and plan on taking the 1z0-007 exam. I would like to practice with some of the questions in the back of the guide, but don't have the scripts to build the tables. I could type them out by hand, but thought I would first check here to see if anyone has, or knows where I can find, the scripts to build these tables so I can save myself some time.

Thanks
Shava

View 1 Replies View Related

How To Substring From 12 Char To 8 Char Itemid

Jun 19, 2008

Hi,


alter PROCEDURE [dbo].[PPUpdateIWDetails]

(
@CompanyID NVARCHAR(36),
@DivisionID NVARCHAR(36),
@DepartmentID NVARCHAR(36),
@ItemID NVARCHAR(36),
@OrderNo NVARCHAR(36),
@LineNo NVARCHAR(36),
@TAllotedQty Numeric,
@EmployeeID NVARCHAR(36),
@Trndate datetime
)
AS
BEGIN
By default iam passing 12 char itemid as parameter...

Here iam selecting the itemid from InventoryLedger -if it is 8 char than this query should be executed
IF EXISTS(SELECT ItemID FROM InventoryLedger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID)

BEGIN
DECLARE @Qty INT

select @Qty =QUANTITY from inventoryledger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID
select qtyonhand=qtyonhand+@Qty from InventoryByWareHouse where ItemID=@ItemID
END

Here iam selecting the itemid from InventoryLedger -if it is 12 char than this query should be executed(both queries are same)
IF EXISTS(SELECT ItemID FROM InventoryLedger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID)

BEGIN
DECLARE @Qty INT

select @Qty =QUANTITY from inventoryledger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID
select qtyonhand=qtyonhand+@Qty from InventoryByWareHouse where ItemID=@ItemID
END

View 11 Replies View Related

Drop All Indexes In A Table, How To Drop All For User Tables In Database

Oct 9, 2006

Hi,I found this SQL in the news group to drop indexs in a table. I need ascript that will drop all indexes in all user tables of a givendatabase:DECLARE @indexName NVARCHAR(128)DECLARE @dropIndexSql NVARCHAR(4000)DECLARE tableIndexes CURSOR FORSELECT name FROM sysindexesWHERE id = OBJECT_ID(N'F_BI_Registration_Tracking_Summary')AND indid 0AND indid < 255AND INDEXPROPERTY(id, name, 'IsStatistics') = 0OPEN tableIndexesFETCH NEXT FROM tableIndexes INTO @indexNameWHILE @@fetch_status = 0BEGINSET @dropIndexSql = N' DROP INDEXF_BI_Registration_Tracking_Summary.' + @indexNameEXEC sp_executesql @dropIndexSqlFETCH NEXT FROM tableIndexes INTO @indexNameENDCLOSE tableIndexesDEALLOCATE tableIndexesTIARob

View 2 Replies View Related

Char(1) And Char(2) Take Same Space?

Aug 21, 2007

I create two tables:

create table table1
(
col1 char(1)
)

go

create table table2
(
col2 char(2)
)

go

I add some records to two tables after createing operation completed.

Then i use dbcc page command to oversee the structures of data page in two tables.
I found some interest things:
The rows in two tabes take up same space:9 bytes

You can see the "9" on top of the data, for example:Slot 0, Offset 0x60, Length 9, DumpStyle BYTE
or calculate from the offset array



Any suggestions?

View 14 Replies View Related

Rollback Will Drop Created Tables And Drop Created Tables In Transaction..?

Dec 28, 1999

Hi folks.

Here i have small problem in transactions.I don't know how it is happaning.
Up to my knowldge if you start a transaction in side the transaction if you have DML statements
Those statements only will be effected by rollback or commit but in MS SQL SERVER 7.0 and 6.5
It is rolling back all the commands including DDL witch it shouldn't please let me know on that
If any one can help this please tell me ...........Please............
For Example
begin transaction t1
create table t1
drop table t2

then execute bellow statements
select * from t1
this query gives you table with out data

select * from t2
you will recieve an error that there is no object

but if you rollback
T1 willn't be there in the database

droped table t2 will come back please explain how it can happand.....................

Email Address:
myself@ramkistuff.8m.com

View 1 Replies View Related

Bit Or Char?

Dec 8, 2005

Sql Server uses bit field for boolean while Access uses Y/N. What are the pros and cons of either way? Thanks.

View 14 Replies View Related

What Does It Mean Char(13) And Char(10)

May 4, 2000

What does it mean char(13) and char(10) when I use this in my sql code

ali

View 1 Replies View Related

Char To Bit

Jul 23, 2005

I am importing a table where I need to convert a char(1) with thevalues of 't' or 'f' into a bit field with valies of 1 or 0. Is therea built-in function that does that? I've been searching, but I can'tfind an answer.

View 6 Replies View Related

Concatenate Int && Var Char - SQL

Oct 1, 2007

Hi, I am trying to write some simple SQL to join two fields within a table, the primary key is an int and the other field is a varchar. But i am receiving the error:'Conversion failed when converting the varchar value ',' to data type int.The SQL I am trying to use is:select game_no + ',' + team_name as matchfrom result  Thanks 

View 2 Replies View Related

Char Vs Varchar

Dec 5, 2001

Hi,

Does any body know of any performance implications of using 'varchar' data type against 'char'?

I have some columns that are using 'char' data type, but the data in them is not fixed length. So, to gain some disk space I am planning to change the data type to 'varchar'. But, I am concerned if there will be any performance de-gradation or any other implications of doing this.

Regards
Chakri

View 3 Replies View Related

CHAR Vs VARCHAR

Mar 26, 2001

Hi,

Is that true that using CHAR datatype improves the performance comparing to VARCHAR

thanks
indeed.

View 3 Replies View Related

Non-English Char

Nov 2, 2000

Would the char or varchar datatype fieldname accept non-english letters like Japanees, Chinees, Russian..etc.

Or should I use nchar or nvarchar?

Thanks

View 2 Replies View Related

VARCHAR Vs. CHAR

Oct 27, 2000

Why would you want to use char when you have varchar? Is there any performance hit using a varchar and the size you make that varchar?

Debate going at work.

Phil

View 7 Replies View Related

Varchar V Char

Feb 17, 1999

I have recently inherited a database where all of the tables use varchar instead of chars for fields. Very , very few of these fields are involved in keys of even indices, but performance is an issue. I thought that I had read that varchars are worse for performance than chars when page splits may occur. Is this related to updates only, or does it matter?

Any help appreciated.

View 1 Replies View Related

Char (8) Vs. Varchar (8)

May 8, 2006

In relation to the code in this thread

http://forums.databasejournal.com/showthread.php?t=42622

My customer code field is Char (8) but accept an argument of Varchar (8) to my stored procedure. Don't ask me why!?!!

The customer code could be anything from 'A' to 'ZZZZZZZZ'.

Will this have any effect especially relating to overhead and retrieving incorrect data?

View 1 Replies View Related

Addition Of Char + Int !!!

Jan 15, 2002

Hi Everybody,

I hv executed the following query in the Query Qnalyzer
(Ofcourse I am Using SQL 2000 Enterprise Edition) and Surprisingly
I am getting the Output as follows,

query:-
select '5' + 10

Output:- 15

Can anybody please tell me, why it is happening like this? OR Did I miss any Configuration Parameter in the Server Settings?.

Tks in Advance,
Sam

View 1 Replies View Related

Getting MAX From Char Numbers

Jul 28, 2001

I have a table which will recieve and interface file to be loaded. All the fields are there except an account_id field which is a char(12), but the data is a number 000000000001, 000000000002, etc. These numbers are to be incremented by one. I understand how to write the process using a cursor to run through all the records and to increment them before loading. My question is the best way to get the max number in the existing table which is the char(12) , and icrement the number by one, but retain the leading zeroes I will need. Anyone had the pleasure of doing this providing input greatly appreciated.

View 5 Replies View Related

Convert Char(1) To Int

Feb 12, 2008

I'm looking through some data in a third party application, trying to figure something out for a report. There is a char(1) column holding control characters that apparently effects the status of certain records, and whether they should appear on the report. I want to look at the integer value of those characters rather than the character representation, but I can't get it to work. I keep getting "Error converting data type varchar to numeric." I'm trying to do something like this:
Code:

SELECT CONVERT(int, MyColumn) As IntValue FROM MyTable

I've tried every combination of cast and convert I can think of, as well as numeric data types other than int. There aren't that many distinct values, so I'm just going to do this manually, but I still want to know why it won't work, or what I'm doing wrong. Any thoughts?

View 2 Replies View Related

Char Type In MS SQL

Dec 12, 2005

Dear All,

I am new to MS SQL. One VB application that I need to maintain using it.
There is one problem reported but I couldn't explain: one field is declared
as Char (20), but the application seems able to insert a string with length
even 30. There is no character truncatd when retrieved neither.

However, I cannot simulate the case in the MSSQL database manager. When I executed a SQL script to insert, I was simply not allowed to do so.

Any explanation to the sDid anyone encounter same thing before?
Thanks for any hint.


Regards

View 3 Replies View Related

Char Vs Varchar

Feb 21, 2006

Hi,
This question may sound silly,but please comment.
Please tell me a situation where char should be used and not varchar.
Let us assume that we are dealing with non unicode characters.
Well, I find varchar is always smarter than char, so why char?
Thanks!!
Rudra

View 14 Replies View Related

Varchar And Char

Feb 9, 2004

i would like to know if there is an overhead in using VARCHAR when you use to store it...

a colleague of mine claims that if the field is defined to be VARCHAR the system creates and additional column DOUBLE/DECIMAL with storage size of 17/18bytes.

such that if the size of the varchar field is less than 30 it is better to be defined as CHAR instead.

please help me out here... i think there's something wrong with his statement, but i need concrete proof to it... a link to page or pdf file would be very much appreciated.

View 2 Replies View Related







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