How To Import From A String Representing A Number...
Oct 29, 2007
Hello
I am importing from a comma delimited text file. A certain string column has values that represent numbers, such as "US$ 20", "30", "40 - 50". I would like to import the number, and if the cell does not contain a string representing a number (example: "I don't know"), a NULL value should be imported instead for that cell.
Hi, I need to represent two different (number) fields in the same textbox , one number format is C0 (Currency) and other one is Percentage(P1), how can i keep this number format applicable to appropriate fields?
for exaple this is the expression to represent the two fiels in one textbox.
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.
In MySQL I can represent a string as the following:
X'6162636465'
However, I can't seem to find an equivalent that is supported MS SQL from the last hour and a half of searching the net. Does anyone know of any way to do this?
I need to represent a graph in TSQL. The graph is directed. It is essentially a number of trees which all have various (non-root) nodes in common with each other.
HiI have a table in SQL Server 2000 that has following data:PunchTime PunchType11:45:00 In12:45:00 Out1:45:00 In3:15:00 OutIs there a way in SQL to represent this in the following format:In Out In Out11:45:00 12:45:00 1:45:00 3:15:00Thanks
I have a string in form "abcdefg 12355 ijklmn"Now I want get only the number 12355 within the string !!Is there any function available in T-SQL of Sql server 2K??Thanksfor any help
I've just upgraded from Access to SQL 2000 and am having problems with a line of SQL code.
In Access I sorted on a text column of part numbers where a number within the text was the important sort value.
Text was typically "AB 1234 A" "AB 34 B" "AB 73000" The important sort has to be on the numeric value of the part number.
Access Code that worked was: ORDER BY Val(MID(Parts.PartNo,4,6))
Seeing both Val() and MID() are not acceptable in SQL 2000 I ended up using Substr(Parts.PartNo,4,6) but this returns a string sort where 100 appears before 25 etc.
Can anyone help point me in the right direction? Many thanks Peter
We are building an application with a database that contains Jobs. These Jobs have properties like Name, Code etc. and some custom properties, definable by the application admin. For bulk import of Jobs, we want to allow the import of an Excel sheet with the columns Name, Code and a variable amount of columns. If the header names of these columns in the Excel sheet match the name of a custom property in the system we want to add the value of that cell into the database as property value.
In our Data Flow of our Import Package in SSIS we added an Excel Source that points to a test excel sheet with the Name and Code columns and €“ for this example - 3 custom property columns (Area, Department, Job Family). When we configure the Excel Source in the Excel Source Editor, we have the option to select the Columns from the Available External Columns table. But here lays the problem, we do not know at design time, what custom property columns to expect. We DO expect the Name and Code columns, but the rest is uncertain at design-time.
That raises the question: Is there some way to select all of any incoming columns (something like a SELECT * in T-SQL)? This looks like a big problem since it would mean that the .DTSX XML that is being generated at design-time would need to be updated at run-time to reflect the variability of the columns that might be encountered while reading the excel sheet.
Then, we thought, we could add a Script Component to our data flow that passes some kind of DataSet (or DataReader) in which we can walk through the columns ourselves? But then still, we miss the option to include ANY of the columns while reading an Excel sheet (or any other datasource by the looks of it)
We are aware of the option of optional columns in combination with the RaggedRight option, but it seems that we would have to put all of the columns of a row in just one column and then extract all the columns later with Derived Columns. But then, since the source import file is being prepared by an application admin, we want don€™t want to burden him with this horrendous task of putting everything in one column.
We would like to have some way of iterating through all the columns, either in a Script Component or maybe with a Pivot/Unpivot mechanism.
Does anyone have any suggestions? Are there other options we should have considered?
Each unit NAME and part NAME is unique. So what kind of performance would I be losing if I were to do something like:
PROCEDURE addPartToUnit( VARCHAR(20) sPartName, VARCHAR(20) sUnitName ) -- Now in this procedure i'll just get the id's via the names from a select statement
Versus
PROCEDURE addPartToUnit( nPartId INTEGER, nUnitId INTEGER ) -- In this proc, i directly input the primary keys of the table so no lookup is necessary
The reason is that I would like for developers to be able to write code without having to know the id's.
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
Hi,I want to get the string representation of a hex number from avarBinary column of a table.For example I want to get the output : 'The Hex value is 0xFF'butselect 'The Hex value is ' + convert(varchar(10), 0xFF)retruns the ascii charecter for 0xFFAny idea how do I get the hex form as it is?thanks.Supratim
Hi, ORDER BY will sort string (varchar) field which "11" < "2", is there any way I can sort them as number so "11" > "2"? what if there is character inside, like "11a", "2b", in this case, it should sort like, "1" "2" "11" "1a" "2a" "11a" "1b" .... Is this possible? also, I tried to google this but not find anything help. what's best keyword to use?
I am trying to convert some strings to number datatype. Some numbers are like this. 1,45.45- 21.21- 4,611.20- Is it possible to convert these type of strings to number datatype. Thank you.
Hi guys, Here is the html string that I want to transfer it to another variable so, I can post it to my sql server database <span style=""font: 12px arial; color : #000000; text-decoration : none;""><br>MODEL- USB01000C01CL VENDOR- ACTIONTEC ELECTRONICS<br> <br>FEATURES- VoSKY Chatterbox for Skype<br> Plug-and-Play Speakerphone for Skype!<br> VoSKY Chatterbox from Actiontec is the go-anywhere speakerphone <br> solution for Skype! No software or special drivers required. Simply <br> plug your VoSKY Chatterbox into any computer and you are ready to <br> start talking! <br> Make Skype Calls on a Speakerphone Plug Chatterbox into your <br> computer, and make or receive a Skype call as you normally would. <br> Then talk to your Skype contacts, hands-free and without wearing <br> headsets! <br> You do not need to download any additional drivers or software. Just<br> take Chatterbox, plug it into any computer, and you are ready to <br> go! <br> Chatterbox offers superb sound quality with the latest technology in<br> full duplex audio, DSP-enhanced sound quality, and echo <br> cancellation. <br>* Verified by and certified for Skype <br>* Replaces your headset/microphone <br>* Small, lightweight device goes anywhere you go <br>* Full duplex speakerphone with adjustable volume and mute control <br>* DSP-enhanced sound quality <br> <br> -- SPECIFICATIONs ------------------------------------<br>CONNECTORs - (1) USB 2.0/1.1 port<br> (1) 2.5mm Headset Jack<br>INDICATORS - LEDs for Ready, Microphone Mute<br>FUNCTION KEYS- Volume Up, Volume Down, Microphone Mute <br>SPEAKER - 1w peak, 40 mm, 4 ohm, 120 Hz to 6 KHz, 120 dB <br>MICROPHONE - Voice pick-up range up to 4 meters <br>APPROVALS - FCC, CE<br>REQUIREMENTS - PC running Windows 2000/XP with one available USB port. <br>DIMENSIONS - 7.7cm x 5.8cm x 2.1cm WT. 50 grams<br> <br><br>MANUFACTURER WARRANTY: 1 YEAR</span>
however If I just do; dim myvariable as string = htmlvalueatabove after importing the myvariable value to the sqlserver my asp.net detailview control only able to show only first 17 letters . Up until "fo" I am sorry if I am not able to provide you clear question. I am so frastrated at the moment, after 6 coffie and 2 minutes bathroom break I can't write anymore. I will shutup and wait for one you and respond.
Lets say I have a table named Projects with the data below.Y07001Y07002Y07003Y07010Y07011I want to pick up the last 3 numbers and add a one to it so. Declare @Count as varchar(3) SELECT Top 1 @Count = Right(Project, 3)+1 FROM Projects Order by ID desc SELECT @Count This is what I am using. It picks up the last entry, add a one to it and gives me 12 in return. What i want is 012, not 12
In short: I want my following problem to work with a LIKE instead of exact match and if possible be faster. (currently 4s)
Problem: I got a set of rows with varchar(50), spread out over multiple tables. All those tables relate to a central Colour table. For each of the columns, I want to match the values with a set of strings I insert and then return a set of Colour.Id
E.g: input: 'BLACK', 'MERCEDES', '1984' Would return colour ids "025864", 45987632", "65489" and "63249" Because they have a colour name containing 'BLACK' or are on a car from 'MERCEDES' or are used in '1984'.
Current Situation: I) Create a table containing all possible values CREATE TABLE dbo.CommonSearch( id int IDENTITY (1, 1) NOT NULL, clr_id int, keyWord varchar(40), fieldType varchar(25) And fill it with all the values (671694 rows) ) II) Stored Procedure to cut a string up into a table: CREATE FUNCTION dbo.SplitString ( @param varchar(50), @splitChar char = '' ) RETURNS @T TABLE (keyWord varchar(50)) AS BEGIN WHILE LEN( @param ) > 0 BEGIN declare @val varchar(50) IF CHARINDEX( @splitChar, @param ) > 0 SELECT @val = LEFT( @param, CHARINDEX( @splitChar, @param ) - 1 ) , @param = RIGHT( @param, LEN( @param ) - CHARINDEX( @splitChar, @param ) ) ELSE SELECT @val = @param, @param = SPACE(0) INSERT INTO @T values (@val) END RETURN END III)Stored Procedure to query the first table with the second one CREATE PROCEDURE [dbo].[GetCommonSearchResultForTabDelimitedStrings] @keyWords varchar(255) = '' AS BEGIN SET NOCOUNT ON; select clr_id, keyWord, fieldType from dbo.commonSearch where keyWord in (select * from splitString(@keyWords, '')) END
So, how can I use a LIKE statement in the IN statement of the last query. Furthermore, I was wondering if this is the best sollution to go for. Are there any better methods? Got any tuning tips to squeeze out an extra second?
I've got a string of numbers, say 123456 (the actually number is 12 digitslong). I need to calculate the sum of each individual number in the stringof numbers, so in the example of 123456 the sum would be 21 (1+2+3+4+5+6).Thanks
I am trying to use DTC to import about 500 records from an Excelsheet to an SQL database.
Some fields contain strings with a length of about 1700 characters.
When i'm trying to execute the DTC generated code it is giving an error and saying that the maximum string length of 255 has been reached. Althoug the column in the database is defined as nchar(1750).
I'm trying to import a large .txt file into SQL but a regular bulk insert will not do as there are no delimiters. Each line contains roughly 1080 bytes of data that are scrunched together. (1 byte - represents one character) The only thing I know for sure is the start and end position for each column entry which is fixed-format. For example:
Hello experts, Suddenly I find myself in need of a SQL search that ONLY starts at a record. I need to page through the existing records, but start at the users choice.
I was wondering what would be the best way to remove special characters like, '-', '&' '(',')','#','*', etc... from a number string. To be specific a phone Number string where the string is >= 10.
For the above string, which string function can be used to find the number of occurences of a particular character, for example, ','? For this example, the answer should be 4. Is there any built-in function in SQL to do this?
In t-sql 2008 r2, I would like to know how to select a specific string in a varchar(50) field. The field in question is called 'CalendarId'.
This field can contain values like:
xxIN187 13-14 W Elem HS321 13-14 D Elem IN636 13-14 C Elem 030 13-14 clark middle.
What I am looking for is the first position that contains a number value for the length of 3. Thus what I want are values that look like the following: 030, 636, 187.What I know that I want is substring(CalendarId,?,3).The question mark is where I want the starting location of a number value (0 to 9) of the value in CalendarId . I tried pathindex but my syntax did not work.
I have a query which runs exactly as I want it to. Let's say it returns this in a table:
IDNumber 123 212 312
I want to change (find and replace?) all the number 12s in the 'Number' column for a string. I want to change the 12s to the word: HelloWorld. I don't want to update the table, merely the table that is being returned in the query.