Concatination Help!
Jul 22, 2002How do I get the file name appended by today's date in the following format dynamically?
example:
filename= orderfile.xls
new file name should be: orderfile_020722.xls
Thanks for any help.
Sonia.
How do I get the file name appended by today's date in the following format dynamically?
example:
filename= orderfile.xls
new file name should be: orderfile_020722.xls
Thanks for any help.
Sonia.
How can we find out the position of the last space(' ')in a sentence?
Example sentence:
My name is John.
Result: 11 (since the last space starts at 11th character in the sentence)
Any clue??
thanks.
John.
How can we find out the position of the last space(' ')in a sentence?
Example sentence:
My name is John.
Result: 11 (since the last space starts at 11th character in the sentence)
Any clue??
thanks.
John.
We need to concatinate the following two fields and make a third field upto max. of 100 char. While concatinating these two fields, the second field should not be cut in the middle of a word after concatination and should end in "..." as shown in the example below:
Product_name_field1: This is varchar(32)
Example: Classic-Fit Pleated-Front Khakis: This is varchar(1000)
Product_name_field2: (length varies from 120-1000 char)
Example: We make our khakis of 100% cotton twill and then garment-wash them and ship them for ...
Result: incorrect way:
Classic-Fit Pleated-Front Khakis,We make our khakis of 100% cotton twill and then garment-wash th...
Result: Correct way:
Classic-Fit Pleated-Front Khakis,We make our khakis of 100% cotton twill and then garment-wash...
I appreciate for any help.Thanks.
John.
I have a query in SSIS which works fine.
SELECT SUBSTR(DOB_CHAR, 7, 2) AS EXP3, SUBSTR(DOB_CHAR, 5, 2) AS EXPR1, SUBSTR(DOB_CHAR, 1, 4) AS EXPR2
FROM WAITLIST
results
20
12
1948
07
09
1982
29
07
1960
However, when I try to concatinate, it falls over
SELECT SUBSTR(DOB_CHAR, 7, 2) + '/' + SUBSTR(DOB_CHAR, 5, 2) + '/' + SUBSTR(DOB_CHAR, 1, 4) AS EXPR2
FROM WAITLIST
The syntax works ok on SQL Server query, but not in SSIS.
(Reading from Oracle, number 19481220, an is varchar2)
Select will work with pipes (as in oracle) but it must be of the form | | '/' | |
that is
SUBSTR(DOB_CHAR, 7, 2) | | '/' | | SUBSTR(DOB_CHAR, 5, 2) | | '/' | | SUBSTR(DOB_CHAR, 1, 4) AS EXP2
I would like to know if this is correct, or is it because I am reading from Oracle?
I do get an error message in query builder, but the query then runs as required.
Error in list of function arguments: '|' not recognized.
Error in list of function arguments: ',' not recognized.
Error in list of function arguments: ')' not recognized.
Unable to parse query text.
Any views?
I have a need to query some data and string all my results by id. I am fairly close to the results but stuck on the final piece. Any help would be greatly appreciated.
Here's the scenario: My data looks as follows:
UserID
Results
1095
,,,,,,,
1095
,,,,,8,,
1095
,,,,,,,
1095
,,,,,8,,
1247
,2,3,,,6,,,
1247
,2,3,,,6,,,
1247
,2,3,,,6,,,
1247
,2,3,,,6,,,
4069
,,,,,,,
4069
,,,,,,,
4069
,,,,,,,
4069
,,,,,,,
4070
,,6,,,,,
4070
,,6,,,,,
4070
,,6,,,,,
4070
,,6,,,,,
I want to query it and end up with the results all strung together under each UserID as follows:
1095
,,,,,,,,,,,,8,,,,,,,,,,,,,,8,,
1247
,2,3,,,6,,,,2,3,,,6,,,,2,3,,,6,,,,2,3,,,6,,,
4069
,,,,,,,,,,,,,,,,,,,,,,,,,,,,
4070
,,6,,,,,,,6,,,,,,,6,,,,,,,6,,,,,
I know if I use the following code I can string all the results together
select *, Cast((SELECT Results + ',' FROM #temp1 FOR XML PATH('')) as varchar(max) ) as Results from #temp1
But I can't figure out how to break it down by individual UserID. Any help is greatly appreciated. Thanks in advance
I need to execute the following code by passing the username as a parameter.Can I get help to complete the SQL statement??
exec ('sp_changeobjectowner '+ @Table_name +','+@ToUser) ---> This works fine.
But I need to have something like this:
exec ('sp_changeobjectowner '@username.+ @Table_name +','+@ToUser)
Note:
Here is the sample working syntax:
sp_changeobjectowner 'user1.eb_sku', user2
So,I need user1 and user2 as two different parameters.
As you see,I need to qualify the table name with the owner name which itself I want to pass as a parameter.
Any help with syntax is greatly appreciated!!
Di.
hi all,
The situation is something like this
id name
------------------
1 lad
1 big
2 sen
2 zen
The output would be
id name
------------------
1 lad,big
2 sen,zen
Is there a way to implement this is Reporting services.This has to be achieved on the fly which the report is being executed !
Any help on this is highly appreciated .
I have a stored procedure where I want to loop through the nodes of an XML type and use its values to perform string concatination.
I'm new to the XML type in SQL Server and to XQuery in T-SQL and am wondering if someone can point me in the right direction. The XML samples I've found so far focuses on returning a set of nodes or building XML to store, not reading it in T-SQL and building strings.
hello,
i have a problem to concatinte sigle quotes to variable value
declared a variable name @a as varchar(30)
set @a='keerthi'
now i would like to concatinate sigle quotes in front of string and back of string.
set @a= "'" + @a + "'"
here it is giving error.
plese give me some solution
thanks
ravi
Hello...
I am going crazy trying to figure out how to do this. I have a flat file which I am massaging the data and loading into a table here is an example of a line out of the flat file:
"ABC NUTRITIONAL PRODUCTS","550","","","N","FAIR OAKS","","","COLORADO SPRINGS","C0","","","","","","","","A","","",""
My problem is that I have one field which is this address in a concatinated form. The fields that do not apply to this entry are suite#, floor# and other columns which are designated by the "" characters. The final concatinated addres field looks like this:
"550""""N""FAIR OAKS"""
I would like to remove the "" characters in the concatinated string. I just don't know the best way to do this? I was told DTS had a way of removing the "" from the flat file source. Since I have not used DTS extensively I am not sure if this is true. I was wondering how in SSIS I could go about removing the "" marks without removing the "" say if someone is quoted eg. John said "This is only a test". Removing the quotation marks in this instance would be changing the data. I am not sure how to do this and any help or advice is greatly appreciated!
Thank you...