Substring over varchar(max) using SSIS
Hi,
I´m facing the next issue: our data source provides a table with a column with varchar(max) datatype (it comes from a BLOB oracle column source system). The content of this column it´s actually string (html text generated by an editor) over which we
need to apply some sort of substring to remove undesired characters (the infamous Byte of Mark -BOM-). Unfortunately neither SSIS functions or T-SQL functions can do a substring on a varchar(max) content, so I imagine that I will need some kind of programatically
approach creating a custom function. Has anyone done something similar?
Thanks in advance
I am thinking you could measure the size of the content, break into chunks and convert into a varchar(8000) temp holder where you can manipulate on text.
PS: I am not sure how Byte of Mark -BOM chars look like
Arthur My Blog
Similar Messages
-
SQL Server 2014 Enterprise 12.0.2370 to Oracle 11.2.0.3.0
SSIS Developed on VS2013 sql data tools. 64 bit win2k12 R2 workstation with Oracle 32 and 64 bit dlls and Attunity 3.0 32 and 64 bit drivers for SSIS Oracle.
I can successfully define my sql data source and my oracle destination. One of the fields in the SQL Server source is varchar(max). Some of the records have 32,000+ characters.
when i map the varchar(max) column to the CLOB oracle column i get no errors. i save the project and come back and the source column in the mapping in the destination definition is set to IGNORE. No matter what i do it does this. I run the package and it
exports all of the columns except the varchar(max) column. Compiling and running the project in VS2013 gives no errors.
It was my understanding that at one time Attunity did not support CLOB but starting with version 2.0 and SQL Server 2012 Enterprise, the field type was supported.
Any help on this one is greatly appreciated.I think you have witnessed the fact it does not.
Arthur
MyBlog
Twitter -
Flat files data comma separated using SSIS.
Hi,
I have multiple flat files which come in comma separated columns. See example below :
Customer Data
CustID,FName,LName,Disease,Email,Phone
12345,Xyz,Smit,Bronchitis, Asthma and fever,[email protected],80000000
12346,Abc,Doe,fever Headache,[email protected],90000000
12347,Klu,joe,Sugar, cough and fever,[email protected],12345678
Please look at the ID's 12345 and 12347. The disease column has a internal comma space between. How do i remove the comma spaces in the disease column, so that it can be loaded from flat file to sql table using SSIS. ?
Please help !
ThanksHere is a full solution base on my post above (first option)
1. create temp table (Give it a unique name):
create table #T (Txt NVARCHAR(MAX))
GO
2. Insert all the data into temporary table. Each line in the text file, is a value for one column in a row in the table.
-- I will jump to the table and use simple insert.
-- If you have problem with step 1 then please inform us (this is simple bulk insert basically)
insert #T (Txt) values
('1234435,Xyz,Stemit,Brfsdonchitis, Asthma and fever,[email protected],80000000'),
('12346,Agjdfjbc,Doge,fevhhhher Headsxdshhache,[email protected],90000000'),
('123447,Klu,joe,Sugar, cough and fever,[email protected],12345678')
GO
the result should be like this:
Txt
1234435,Xyz,Stemit,Brfsdonchitis, Asthma and fever,[email protected],80000000
12346,Agjdfjbc,Doge,fevhhhher Headsxdshhache,[email protected],90000000
123447,Klu,joe,Sugar, cough and fever,[email protected],12345678
I use a SPLIT Function named Split_CLR_Fn. This is a CLR Split function that get input <string to split> and <string as delimiter,> and it return table with 2 columns ID, SplitData
For example if you use: SELECT * from Split_CLR_Fn('text1,text2,text3,',') then you get result:
ID SplitData
1 Text1
2 Text2
3 Text3
** You can find in the internet several good functions, I HIGHLY RECOMMENDED NOT TO USE T-SQL FUNCTIONS but CLR FUNCTION. Check thi link to understand why:
http://sqlperformance.com/2012/07/t-sql-queries/split-strings
** This is the best function that I know about and I use it, but I change the code a bit to return 2 columns and not just the SplitData as in this blog: http://sqlblog.com/blogs/adam_machanic/archive/2009/04/28/sqlclr-string-splitting-part-2-even-faster-even-more-scalable.aspx
That's it :-) we are ready for the solution which is very simple
Solution 1 (BAD solution but easy to write):
select
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 1) CustID,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 2) FName,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 3) LName,
STUFF((select ',' + SplitData from Split_CLR_Fn(Txt,',') where ID > 3 and ID < (select MAX(ID) from Split_CLR_Fn(Txt,',')) - 1 for XML path('')), 1 , 1,'') Disease,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = (select MAX(ID) from Split_CLR_Fn(Txt,',')) - 1) Email,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = (select MAX(ID) from Split_CLR_Fn(Txt,','))) Phone
from #T
GO
Solution 2: better in this case since the format is constant (this is the solution I wrote about above)
;With MyCTE as (
select
Txt,
SUBSTRING(Txt, 1, CHARINDEX(',', Txt, 1) - 1) as CustID
, SUBSTRING(
Txt
,CHARINDEX(',', Txt, 1) + 1 -- I start from the end of preview len
, CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)- CHARINDEX(',', Txt, 1) - 1
) as FName
, SUBSTRING(
Txt
,CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)+1 -- I start from the end of preview len
, CHARINDEX(',', Txt, CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)+1) - CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1) - 1
) as LName
, RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1) as Phone
, RIGHT(LEFT(Txt, Len(Txt) - Len(RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1)) - 1), CHARINDEX(',', REVERSE(LEFT(Txt, Len(Txt) - Len(RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1)) - 1)), 1) - 1) as Email
from #T
select CustID,FName,LName, Phone, Email, SUBSTRING(Txt, Len(CustID) + Len(FName) + Len(LName) + 4, Len(Txt) - Len(Email) - LEN(Phone) - Len(CustID) - Len(FName) - Len(LName) - 5) as Disease
from MyCTE
I hope that this is useful :-)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
Hi Forum ,
I need to do cleanup on a column to display clean data by eliminating the various <HTML> in the source. I would like to do a replace using the charindex, but my query becomes too big and i might miss some tags. What would be the best approach removing
the <tags> or formating them to display in correct format? .
Please give me some example if we can format data according to the tags using SSIS components.
<p><font face="Times New Roman"><span style="font-size: 11pt; ">DAVID BACKER, JR
</span><span style="font-size: 11pt; color: navy; ">L
</span></font><span style="font-size: 11pt; ">
<font face="Times New Roman"> 11111 Erwin 185th Ter <br />Jersey Gardens, NJ 10156/* Microsoft SQL Server Integration Services Script Component
* Write scripts using Microsoft Visual C# 2008.
* ScriptMain is the entry point class of the script.*/
// C# code
using System;
using System.Data;
using System.Text.RegularExpressions; // Added
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
// Method that will be executed for each row.
public override void Input0_ProcessInputRow(Input0Buffer Row)
// Replace the value of the message column
Row.Notes = RemoveHtml(Row.Notes).Replace(" ", " ")
.Replace("&", " ").Replace("-->", "
").Replace(""", "\"")
.Replace("<", "<").Replace(":
YES", ": YES ").Replace(": NO", ": NO ");
// A string method that removes html tags
// with a regex pattern
public String RemoveHtml(String message)
// The pattern for a html tag
String htmlTagPattern = "<(.|\n)+?>";
/// ///"<(.|\n)+?>"
/// ///"(?<=<[^>]*) "
// Create a regex object with the pattern
Regex objRegExp = new Regex(htmlTagPattern);
// Replace html tag by an empty string
message = objRegExp.Replace(message, String.Empty);
// Return the message without html tags
return message;
Ntext Source DataType
I convert the columns to convert(varchar(max),jr.NOTES) as Notes -
Best way to query data with varchar (max) cloumn.
Hi,
I have joined three table and selected 15colmuns over a period of 6months it tooks 10sec .
I selected two more columns with varchar(max) datatype it took me 60sec.
whats the best way to select varchar(max) over a period?
Can anyone please help me on this?
Thanks,I have joined three table and selected 15colmuns over a period of 6months it tooks 10sec .
I selected two more columns with varchar(max) datatype it took me 60sec.
That appears to be normal behavior for any RDBMS.
You can use the LEFT function to limit transmission volume from server to client:
SELECT A.Title, A.DocumentSummary INTO tempdb.dbo.DocText
FROM Production.Document A
CROSS JOIN Production.Document B CROSS JOIN Production.Document C
CROSS JOIN Production.Document D CROSS JOIN Production.Document E;
-- (59049 row(s) affected)
SET STATISTICS TIME ON
DBCC DROPCLEANBUFFERS
SELECT A.Title, A.DocumentSummary FROM tempdb.dbo.DocText A
DBCC DROPCLEANBUFFERS
SELECT A.Title, Prefix=LEFT(A.DocumentSummary,10) FROM tempdb.dbo.DocText A
SET STATISTICS TIME OFF
SQL Server Execution Times:
CPU time = 172 ms, elapsed time = 787 ms.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
(59049 row(s) affected)
SQL Server Execution Times:
CPU time = 62 ms, elapsed time = 560 ms.s.
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
How can I read a file with ASCII Special Character into a SQL table using SSIS 2008?
I've tried everything to read this file and am getting no where. Help how can I read this file and load a SQL table?
RS - AscII - 30 (Record Separator)
GS - AscII - 29 (Group Separator)
Thank you for your assistance - Covi
Mark CovianWe can use script component as source/transformation to read the text file and assign the contains to a string. Split the string by chr(30) i.e RS and finally stored into an array or write to the output buffer of the script component.
For example on how to use script component refer this link
http://social.technet.microsoft.com/Forums/en-US/6ff2007d-d246-4107-b77c-624781baab38/how-to-use-substring-in-derived-column-in-ssis?forum=sqlintegrationservices
Regards, RSingh -
How to add specific header and footer to flat file using SSIS 2008
The SSIS package need to create file with headers, totals and adds a status to position one of the records.
Header: "$$ADD ID=ENTK0557 BID='IA HBZAC14HBZACHRYCORP' PASSWORD='CUSTOMER ' %AU HBZAC14" is added.
$$ADD = Static
ID=ENTK0557 = Static
BID='IA HBZAC14HBZACHRYCORP' = "HBZAC14" is the company, "HBZACHRYCORP" is company name
PASSWORD='CUSTOMER ' = static
HBZAC14 = company
Control Totals:
T010533343 000050 0002659604 000000 0000000000
T = Totals
010533343 = Account Number
000050 = Total records
0002659604 = Total checks
000000 = TBD
0000000000 = TBD
Data for the file
DECLARE
@T AS
TABLE
[BR-ISSUE-VOID-IND] [char]
(1)
NULL,
[BR-ACCT-NBR] [varchar]
(9)
NULL,
[FILLER1] [char]
(1)
NULL,
[BR-SERIAL-NBR] [varchar]
(8000)
NULL,
[BR-CHECK-AMT] [varchar]
(8000)
NULL,
[BR-CK-ISSUE-DATE] [varchar]
(6)
NULL
INSERT
INTO @T
[BR-ISSUE-VOID-IND]
[BR-ACCT-NBR]
[FILLER1]
[BR-SERIAL-NBR]
[BR-CHECK-AMT]
[BR-CK-ISSUE-DATE]
SELECT
'C'
,NULL,' ',30090072,2114.39,100502
UNION
ALL
SELECT
'C'
,NULL,' ',30090190,430.58,100502
UNION
ALL
SELECT
'C'
,NULL,' ',30092371,589.93,100502
UNION
ALL
SELECT
'C'
,NULL,' ',30092550,1198.6,100502
SELECT
FROM @T
File SnapShot.Using SSIS its difficult unless you use a script task after the data flow to add the header footer bits.
A much better option in this case would be bcp as you can generate query with values in the order you want and bcp it out
http://msdn.microsoft.com/en-us/library/ms162802.aspx
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
How to map logical type to varchar(max)?
Hello fellow modelers and developers,
I created a logical model of a database in SDDM and trying to create a relational model for Oracle, DB2 and MSS. The one for Oracle seams fine, but the MSS one is kinda tricky as it seams impossible to map my logical data type "CLOB" to a varchar(max). Of course I could map to TEXT, but according to the SQLServer documentation, I should not use it, but varchar(max) instead.
If I import a DDL file which contains a varchar(max), SDDM creates a DOMAIN with "varchar" as logical type and "max" as size, but the DDL export will contain no size. If there is a way to add this one single tiny data type in my exported DDL without having to do a search replace afterwards I would really like to know.
greetings from Vienna.
edit:
BTW, I am using version 3.0.04.34 on Windows 7 64-bit
Edited by: 896729 on Nov 11, 2011 10:14 AMHello atschabu,
thanks for feedback. I logged a bug for that. It'll be tricky to import it - normally varchar is mapped to Varchar logical type but varchar(max) is something else. Probably we'll create domain and customer can assign proper logical type to it later.
Philip -
Using SSIS 2012 - merge join component to transfer data to destination provided it does not exist
HI Folks,
I have a table - parts_amer and this table exists in source & destination server as well.
CREATE TABLE [dbo].[Parts_AMER](
[ServiceTag] [varchar](30) NOT NULL,
[ComponentID] [decimal](18, 0) NOT NULL,
[PartNumber] [varchar](20) NULL,
[Description] [varchar](400) NULL,
[Qty] [decimal](8, 0) NOT NULL,
[SrcCommodityCod] [varchar](40) NULL,
[PartShortDesc] [varchar](100) NULL,
[SKU] [varchar](30) NULL,
[SourceInsertUpdateDate] [datetime2](7) NOT NULL,
CONSTRAINT [PK_Parts_AMER] PRIMARY KEY CLUSTERED
[ServiceTag] ASC,
[ComponentID] ASC
I need to exec the following query using SSIS components so that only that data ,is transfered,which does not exist at destination -
select source.*
from parts_amer source left join parts_amer destination
on source.ServiceTag = destination.ServiceTag
and source.ComponentID=destination.ComponentID
where destination.ServiceTag is null and destination.ComponentID is null
Question - Can Merge component help with this?
Pl help out.
Thanks.Hi Rvn_venky2605,
The Merge Join Transformation is used to join two sorted datasets using a FULL, LEFT, or INNER join, hence, not suitable in your scenario. As James mentioned, you can use Lookup Transformation to redirect the not matched records to the destination table.
Another option is to write a T-SQL script that makes use of
Merge statement, and execute the script via Execute SQL Task.
References:
http://oakdome.com/programming/SSIS_Lookup.php
http://www.mssqltips.com/sqlservertip/1511/lookup-and-cache-transforms-in-sql-server-integration-services/
Regards,
Mike Yin
TechNet Community Support -
Problem Summary
DG4ODBC: STRING DATA, RIGHT TRUNCATION ERROR WHILE ACCESSING VARCHAR(MAX) COLUMN
Driver
Microsoft® ODBC Driver 11 for SQL Server® - RedHat Linux
Problem Description
When selecting a MS SQL VARCHAR (max) column over a ODBC Gateway database connection I am getting this error from Oracle:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
ORA-02063: preceding 2 lines from <LINK_NAME>
The ODBC driver should map the varchar(max) column to SQL_LONGVARCHAR which would be appropriate for Oracle but the column is getting truncated
Issue
By default the SQL Server ODBC driver exposes the varchar(max) data type as a SQL_VARCHAR. When reporting the maximum size of a varchar(max) column, the driver returns 0, which is the Microsoft convention for "unlimited".
[ODBC][25518][1399527750.588980][SQLDescribeCol.c][497]
Exit:[SQL_SUCCESS]
Column Name = [raw_response]
Data Type = 0x7fffe3cbe1a4 -> 12
Column Size = 0x7fffe3cbe158 -> 0
Decimal Digits = 0x7fffe3cbe1ac -> 0
Nullable = 0x7fffe3cbe1b0 -> 1
DG4ODBC is unable to interpret a zero length as an "unlimited" size and returns an error when retrieving varchar(max) data.
FreeTDS and DataDirect ODBC drivers return SQL_LONGVARCHAR instead of SQL_VARCHAR with 0 precision. So there is no problem reported for these drivers.
Is there a fix for this or is the Microsoft ODBC driver team working on a fix for the driver regarding varchar(max)?
Regards,
JamesHi James,
Thank you for your question. I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
If you have any feedback on our support, please click
here.
Regards,
Elvis Long
TechNet Community Support -
CFQUERY results return a null value for a varchar(MAX) field in SQL
I'm using ColdFusion 9 and SQL Server 2008.
One the fields in a table is defined as a varchar(MAX). Other fields in the table are ints, varchar(8000) varchar(256), etc.
When doing a query for records in the table and displaying the results using the cfdump tag, I see values in all fields in a row EXCEPT for the data in the varchar(MAX) field. The varchar(MAX) field shows a null value. Yet, I can verify through the SQL interface or through Microsoft Access querying the database that the varchar(MAX) fields have data.
How can I retrieve data from this field type?
Thanks in advance for your help.I'm wrong. I AM getting query results, but not what I expect. I had maxrows set as a variable in my original query, so when it returned 5 rows, the first row always showed as [empty string]. I've tried numerous queries now (where UID >100, where UID >200, where UID> 300, etc.) When I use <CFDUMP> to return the query, the first records always shows empty strings.
Here's an example of some records retrieved from this simple query:
<CFQUERY NAME="BuildBack" DATASOURCE="STORBASE">
SELECT *
FROM CallUnit
WHERE CCU_ID>172
</CFQUERY>
Any ideas?
173
P
tuse
322
340
174
E
323
340
175
P
tuses.
324
341
176
E
325
341
177
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupC
326
342
178
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCa
327
343
179
E
328
344
180
E
329
345
181
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_
330
346
182
P
331
347
183
E
332
348
184
P
333
349
185
P
tuses.SCStat_ID)
334
350
186
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Prior
335
352
187
E
336
353
188
P
337
354
189
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Priorities.SCPriority_ID) LEFT JOIN SupCall_CommTypes ON SupCall_MetaData.CommunicationType = SupCall_CommTypes.SCComm_ID) INNER JOIN SupCall_CallStages ON SupCall_
338
355
190
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Priorities.SCPriority_ID) LEFT JOIN SupCall_CommTypes ON SupCall_MetaData.CommunicationType = SupCall_CommTypes.SCComm_ID) INNER JOIN SupCall_CallStages ON SupCall_M
339
356
191
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_
340
357
192
P
tuses.SCStat_ID) á àh\ (9~ Hbb l_Products ON SupCall_MetaData.Product = SupCall_Products.SCPL_ID) LEFT JOIN SupCall_Priorities ON SupCall_MetaData.Priority = SupCall_Priorities.SCPriority_ID) LEFT JOIN SupCall_CommTypes ON SupCall_MetaData.CommunicationType = SupCall_CommTypes.SCComm_ID) INNER JOIN SupCall_CallSta
341
358
193
P
tuses.SCStat_ID) á àh\ -
Varchar(Max) field cutting off data after 8000 characters SQL Server 2008
Hi,
We have a scenario on which we are preparing the SQL query dynamically by string concatenat and then at the end EXECUTING the query using EXECUTE statement but observed that the VARCHAR(MAX) data type is not storing more then
8000 character.
Here is the code snip.How i am using and where the variable is not storing more them 8000 character
We have a table "tblUserAssignedResourcesData" where we are storing "FilterType" and "FiletrValue" and then preparing the string like this:
DECLARE @sqlQuery_UR VARCHAR(MAX)
SET @sqlQuery_UR=''
DECLARE @agentsColumns_UR VARCHAR(MAX)
SELECT @agentsColumns_UR = ISNULL(@agentsColumns_UR,'') +''''+ FilterValue + ''''+',' FROM @tblUserAssignedResourcesData Where FilterType = 1
SELECT @agentsColumns_UR = LEFT(@agentsColumns_UR,LEN(@agentsColumns_UR)-1)
SET @sqlQuery_UR=@sqlQuery_UR+'[UserAgent] in('+ @agentsColumns_UR +')'
--Upto this all the Agents are storing properly then adding mobility user
DECLARE @mobilityColumns_UR VARCHAR(MAX)
SELECT @mobilityColumns_UR = ISNULL(@mobilityColumns_UR,'') +''''+ FilterValue + ''''+',' FROM @tblUserAssignedResourcesData Where FilterType = 3
SELECT @mobilityColumns_UR = LEFT(@mobilityColumns_UR,LEN(@mobilityColumns_UR)-1)
SET @sqlQuery_UR=@sqlQuery_UR +' or '+'[MobilExtensionID] in('+@mobilityColumns_UR+')'
print '@sqlQuery_UR ->' + @sqlQuery_UR
--Print statement should print all the Agents and Mobility values but it is not printing and hence my SQL query is faling to execute
Anyhelp will be appriciable
Thanks,
BijayWhats the value of @mobilityColumns_UR before the below statement? This would give you
some idea.
--Upto this all the Agents are storing properly then adding mobility user
DECLARE @mobilityColumns_UR VARCHAR(MAX)
SELECT @mobilityColumns_UR = ISNULL(@mobilityColumns_UR,'') +''''+ FilterValue + ''''+',' FROM @tblUserAssignedResourcesData Where FilterType = 3
SELECT @mobilityColumns_UR = LEFT(@mobilityColumns_UR,LEN(@mobilityColumns_UR)-1)
print '@mobilityColumns_UR ->'
+ @mobilityColumns_UR -
Connect two pc's over a lan using labview
Hi,
I am trying to connect two pc's over a LAN using ethernet. Both pc's are connected to the LAN and I can ping each one from the other but I cannot get commseither using the visa vi's in labview or through MAX. In MAX I right clIck 'devices and interfaces' and select create new ->VISA TCP/IP Resource. A dialogue box appears and I select raw socket then click next. I put in the ip address. It looks for a port which I don't know I have tried a few numbers. What am I doing wrong?
Thanks,
StevenWhy don't you just use the TCP functions? There's several shipping examples. I suppose you could write client/server programs with VISA functions but I don't know of any examples of these. You might as well start with something that already exists and modify it for your needs.
I'm not sure MAX will detect just a pc resource unless you start VISA Server on the remote pc. -
Varchar(max) vs varchar(255)
Hi guys,
I'm new to MS-SQL 2005, I will ask you a bunch of questions and I hope I will not be too boring hehe !
I learned that in MS-SQL 2005, you can now use varchar(max), my question is why not always use varchar(max) since it will automatically use only the space needed ? Is there an advantage in specifying a size other than max when you use a varchar for an entry that can vary in length alot ?
Thank you very much,
KonnanThere are a few diferences between VARCHAR(1-8000) and VARCHAR(MAX).
when you store data to a VARCHAR(N) column, the values are physically stored in the same way. But when you store it to a VARCHAR(MAX) column, behind the screen the data is handled as a TEXT value. So there is some additional processing needed when dealing with a VARCHAR(MAX) value. (only if the size exceeds 8000)
VARCHAR(MAX) or NVARCHAR(MAX) is considered as a 'large value type'. Large value types are usually stored 'out of row'. It means that the data row will have a pointer to another location where the 'large value' is stored. By default sql server will try to accomodate the value 'in row' but if it could not, it will store the large values 'out of row'. When values are stored 'out of row' there will be slight processing overhead in reading the information. Here is a good reference: http://msdn2.microsoft.com/en-us/library/ms189087.aspx
I guess you cannot index a VARCHAR(MAX)/NVARCHAR(MAX) column.
coming back to your question:
I dont think it is bad to use VARCHAR(MAX) is bad. If you are storing smaller piecs of data in a VARCHAR(MAX) column, it will be treated as normal. If you dont want to index the column, then you can definitely go with VARCHAR(MAX) option.
But most people do not advise that. First of all, by having a VARCHAR(MAX) will confuse some one who looks at the data later on. For example, if you want to store a comment of 100 characters or address of 80 characters, why should you go for VARCHAR(MAX)? If you use Address VARCHAR(MAX), comments VARCHAR(MAX), Name VARCHAR(MAX), some one trying to read or write data on a later date will be confused. They will not know what is the expected size of the data and they will be compelled to use LARGE VALUE types always.
Again, these are not rules but conventions. -
How to get the most current file based on date and time stamp using SSIS?
Hello,
Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
Thanks
thx regards dinesh vvhi simon
i excuted this script it is giving error..
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
public void Main()
string file = Dts.Variables["User::FolderName"].Value.ToString();
string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
System.IO.FileInfo finf;
DateTime currentDate = new DateTime();
string lastFile = string.Empty;
foreach (string f in files)
finf = new System.IO.FileInfo(f);
if (finf.CreationTime >= currentDate)
currentDate = finf.CreationTime;
lastFile = f;
Dts.Variables["User::LastFile"].Value = lastFile;
Dts.TaskResult = (int)ScriptResults.Success;
thx regards dinesh vv
Maybe you are looking for
-
HT3529 How can I have my phone number pop up when I send a text from my iPad?
I did a test text to my iPhone from my iPad and it came up as my email. How can I make it my phone number so I can text people in my contacts without it showing up as my email?
-
Uploading your photos to a computer
Uploading your photos to a computer Before you upload Create a new folder on your computer where you can store your images. You may wish to create a folder with your name on it under “My Pictures” or directly on your desktop. A separate folder
-
Media Center s/w may be corrupted
I keep getting the error message: Media Center has stopped capturing data due to low data rate in the TV signal... This cannot be so, as the TV signal is driving three televisions. It the Media Center s/w is the problem, how can I reload it? It cam
-
Machine crashing ... kind of
Hi everyone, I was having this problem a while back, but after removing some software which I thought was causing it, it has started to come back again. The problem is that the iMac screen will suddenly freeze with either: • a black and white striped
-
How can i build application using Jdeveloper 10g for Weblogic server 10.3
Hi, We have a requirement where in we want to build an SOA application using Jdeveloper 10g for Weblogic Server 10.3. Is there any way to make a connection to Weblogic Server 10.3 from JDeveloper 10g? If there is any way please share it with me. Than