Inserting A Control Record Into A Flat Text File Through SSIS

May 2, 2006

I am working on an SSIS project where I create two flat files for submission to a data contractor. This contractor requires a control record be the first line in the file. I create the control record based on the table information being exported.

What I would like to know is, is it possible to utilize the Header Section of the Flat File Destination Editor to insert the control record? And, as it is dynamic, what kind of coding must I do in order to utlise this functionality?

Thanks.

View 4 Replies


ADVERTISEMENT

Read Text File From Flat File Connection Manager SSIS

May 13, 2008

Hello Experts,
I am createing one task (user control) in SSIS. I have property grid in my GUI and 2 buttons (OK & Cancle).
PropertyGrid has Properties like SourceConnection, OutputConnection etc....right now I am able to populate Connections in list box next to Source and Output Property.

Now my question to you guys is depending on Source Connection it should read that text file associated with connection manager. After validation it should pick header (first line of text file bases on record type) and write it into new file when task is executed. I have following code for your reference. Please let me know I am going in right direction or not..
What should go here ?
->Under Class A

public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)

{

//Some code to read file and write it into new file

return DTSExecResult.Success;

}


public const string Property_Task = "CustomErrorControl";

public const string Property_SourceConnection = "SourceConnection";



public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)

{

if (node.Name != Property_Task)

{

throw new Exception(String.Format("Invalid task element '{0}' in LoadFromXML.", node.Name));

}

else

{

try

{



_sourceConnectionId = node.Attributes.GetNamedItem(Property_SourceConnection).Value;



}

catch (Exception ex)

{

infoEvents.FireError(0, "LoadFromXML", ex.Message, "", 0);

}

}

}

public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)

{

try

{

// // Create Task Element

XmlElement taskElement = doc.CreateElement("", Property_Task, "");

doc.AppendChild(taskElement);

// // Save source FileConnection

XmlAttribute sourcefileAttribute = doc.CreateAttribute(Property_SourceConnection);

sourcefileAttribute.Value = _sourceConnectionId;

taskElement.Attributes.Append(sourcefileAttribute);

}

catch (Exception ex)

{

infoEvents.FireError(0, "SaveXML", ex.Message, "", 0);

}

}

In UI Class there is OK Click event.

private void btnOK_Click(object sender, EventArgs e)

{

try

{



_taskHost.Properties[CustomErrorControl.Property_SourceConnection].SetValue(_taskHost, propertyGrid1.Text);

btnOK.DialogResult = DialogResult.OK;

}

catch (Exception ex)

{

Console.WriteLine(ex);

}

#endregion

}

View 10 Replies View Related

SSIS - Handling Different Types Of Record In Same Flat File Source

May 10, 2006

Hi,

I've just started looking at SSIS and have encountered what should hopefully be a simple problem to solve. I have a pipe-separated source file that looks like this (I've added Line numbers for simplicity):

Ln 01: HDR|FEED_CODE|31-MAR-2006
Ln 02: Tom|100|Jones|ZZ1 1ZZ|USA
Ln 03: Tom|200|Singer|
Ln 04: Tom|305||Red|Porche ||Lanzarote |Apple|Carrot| | |
Ln 05: Dick|100|Van Dyke|ZZ1 1ZZ|USA
Ln 06: Dick|200|Actor|
Ln 07: Dick|305||Blue|Ford||California |Tomato | |||Beef
Ln 08: Harry|100|Houdini|ZZ1 1ZZ|GBR
Ln 09: Harry|200|Escapologist|
Ln 10: Harryk|305| |Green ||Triumph |Poland|Banana|Sprout| | |
Ln 11: TRL|9


In addition to a header and footer records, this file contains three record types for each person.

Record types are identified by the second column.

Each record type has a different number of columns:

Type 100 has 5 columns
Type 200 has 4 columns
Type 305 has 12 columns

The Row delimiter for all records is the {CR}{LF} character

I've set up a flat file input source and specified {CR}{LF} as the row delimiter for both header and data rows and the "|" character as the field delimiter.

It appears that SSIS is assuming that because the first data row has 5 columns, then everything must fit that format too. So the {CR}{LF} character that separates lines 02 and 03 is interpreted as text rather than a separation character and all remaining | field separators after 305 are interpreted as text containing in the fifth column. SSIS is also complaining that the last row is incomplete.

A bit like this (I've used tildes to indicate column separation):

Tom~100~Jones~ZZ1 1ZZ~USA
Tom~200~Singer~{CR}{LF}Tom~305||Red|Porche ||Lanzarote |Apple|Carrot| | |

I've seen one other reference to this behaviour but the response seemed to be SSIS doesn't know which columns are missing. In this scenario, we don't have missing columns, rather, we have different types of record in a single file. in DTS I would effectively parse the file once for each record type thus:

if cStr(DTSSource("Col002")) = "100" then

DTSDestination("in_Name") = trim(DTSSource("Col001"))
...

Main = DTSTransformStat_OK
else
Main = DTSTransformStat_SkipInsert
end if


...not the most efficient solution I know but the load only runs once a month so this was an acceptable workaround.

DTS was never this fussy but I'm sure this is user error rather than an SSIS limitiion. Can someone please put me straight?

Many thanks,

Greg

View 7 Replies View Related

Integration Services :: Create SSIS Package Dynamically For Inserting Data From Flat File To Table?

Sep 30, 2015

I have requirement like  to develop dynamic package for inserting data from flat file to table.

Find below points for more clarification :--

1) if I changed the flat file values and name  in source variable AND  the table name should be also changed based on variable value .

2) it should dynamically mapped with column values with source file as we have to insert data in target table.

See below diagram for more clarification.

View 10 Replies View Related

Text Qualifier In SSIS Designer For Flat File Source

May 19, 2008



Unlike SQL Server 2000 DTS, SSIS Flat File Connection Manager Editor does not provide available list of Text qualifier,

i tried

-- ""
-- double quote {"}
-- "
--{"}

but none of them worked....!
My file sample looks like this

"Col1","Col2"
"1234","3456"
"3456","1234"

what qualifier should I use then?

Many Thanks,

View 7 Replies View Related

SSIS Flat File Text Qualifier Only Works On Some Machines!

Jan 3, 2008

I have made a package that reads a text file into a table.

The data in the file is roughly as follows.


1, "a", "b,c,ddddd", 4, "ee", 0 with the column sizes int, 1, 50, int, 2, int

On all the desktop Bids environments and a SQL 2005 instance on windows server 2000 the package runs fine.

on the 2 Windows server 2003/SQL 2005 machines a truncation error occurs on col 5.

What is happening is on these machines the text qualifier is being ignored and column 5 is reading as ddddd instead of ee!

I figured this out by changing all fields to text and seeing what came out of the other end.

It is very, very strange and I've hit a brick wall.

If Anyone has any ideas throw them in the mixer please?

Cheers,

Steve

View 5 Replies View Related

SSIS Data Flow Task Fails To Load All Text From Flat File

Jan 2, 2007

Hi Guys,

I
have a flat file which is loaded into the database on a daily basis.
The file contains rows of strings which I load into a table,
specifically to a column of length 8000.

The string has a length of 690, but the format is like 'xxxxxx xx xx..'
and so on, where 'xxxx' represents data. So there are spaces, etc present in the middle.

Previously
I used SQL 2000 DTS to load the files in, and it was just a Column
Transformation with the Col001 from the text file loading straight to
my table column. After the load, if I select len(col) it gives me 750
for all rows.

Once I started to migrate this to SSIS, I
allocated the Control Flow Task and specified the flat file source and
the oledb destination, and gave the output column a type of String and
output column width of 8000. But when I run the data flow task it
copies only 181 or 231 characters out of the 750 required.
I feel it stops where it finds the SPACES and skips the rest.

I
specified row delimiters or CR, and LF. I checked the file under
UltraEdit and there were no special characters in the file that would
cause the problem.

Any suggestions how I can get it to load the full data?

Thanks

View 26 Replies View Related

Formatting Columns For A Flat File Destination Control

Mar 28, 2007

So i've created a flat file destination control and have mapped the columns. At what point can you control which column shows up first?

View 4 Replies View Related

Move First Record From A Flat File To Another

Jul 18, 2007

Hi,



i have simple requirement...but dont know how to proceed. I need to move the first record from a flat file (file1) to another flat file(file2) using SSIS, file1 will have many records but i just need the first one alone to be moved. Any pointers on this would be of much help.



Thanks,

raj

View 4 Replies View Related

Inserting Data To Text File From Database And Inserting Data Back To Database From Text File

Aug 7, 2007

Hello friends....
I am looking for 2 things(using c#.net or vb.net and sql svr 2000)
1.convert data from sql server 2000 database (say customers table from northwinds database) to a text file(separated by commas or just plain space)
2.Insert the data from text file back to database.
Can someone pls give me the detailed code to achieve this....really need this on urgent basis.......Thank You.

View 10 Replies View Related

Export Stored Procedure To Flat File And Add Aggregate To End Of The Text File?

Jan 31, 2008

What is the easiest way to accomplish this task with SSIS?

Basically I have a stored procedure that unions multiple queries between databases. I need to be able to export this to a text file on a daily basis and add a total records: row to the end of the text file.

Thanks in advance for any help.

View 7 Replies View Related

Error (8626) While Inserting Record Into Table With Text Field And Which Is The Base For Indexed View

Mar 14, 2006

I have a problem with inserting records into table when an indexed viewis based on it.Table has text field (without it there is no problem, but I need it).Here is a sample code:USE testGOCREATE TABLE dbo.aTable ([id] INT NOT NULL, [text] TEXT NOT NULL)GOCREATE VIEW dbo.aViewWITH SCHEMABINDING ASSELECT [id], CAST([text] AS VARCHAR(8000)) [text]FROM dbo.aTableGOCREATE TRIGGER dbo.aTrigger ON dbo.aView INSTEAD OF INSERTASBEGININSERT INTO aTableSELECT [id], [text]FROM insertedENDGODo the insert into aTable (also through aView).INSERT INTO dbo.aTable VALUES (1, 'a')INSERT INTO dbo.aView VALUES (2, 'b')Still do not have any problem. But when I need index on viewCREATE UNIQUE CLUSTERED INDEX [id] ON dbo.aView ([id])GOI get following error while inserting record into aTable:-- Server: Msg 8626, Level 16, State 1, Procedure aTrigger, Line 4-- Only text pointers are allowed in work tables, never text, ntext, orimage columns. The query processor produced a query plan that requireda text, ntext, or image column in a work table.Does anyone know what causes the error?

View 1 Replies View Related

Create A Flat File For Each Record In A Table

Apr 20, 2006

I'm rather new to ssis and I've been reading and testing but didn't find a solution for this problem.Supose I've got a table Customer with some fields. One of the fields is CustID.I want to create as many flat files as there are Customers in the table with flat file name set to the CustID.If you could point me in a good direction, It would be nice.Greetings from Belgium

View 4 Replies View Related

Creating One Flat File Per Record In The Data Flow

Nov 30, 2006

I have a table that holds in each record an image (varbinary(max) actually), a text reference for the image and a MIME type for the image. I need to read this table and for each record that has been created since the last run, I need to create a file with the image as the content, the mime type as the file extension and the text reference as the file name. There will be one file created per record found by the data flow source.

I was assuming that I could use the flat file destination and manipulate the file naming using the contents of each record in the flow but am completely stumped on how to achieve this.

Does anyone have any ideas?

thanks

View 3 Replies View Related

Vendor Flat File Contains Multiple Record Layouts

Sep 18, 2006

We have a flat file format generated from a vendor. It contains a "mainframe" view of the data with a header record, batch header record, detailed records, batch trailer record and trailer record. It arrives as a .dat file. What is the best approach to extract the necessary columns out of this file to populate the corresponding SQL server tables and rows?

View 3 Replies View Related

Assigning A Particular Flat File Record To A String Variable

Jun 12, 2007

Hey all!

Okay, can I assign line x of a flat file to a variable, parse that line, do my data transformations, and then move on to line x+1?

Any thoughts?

In other words, I'm looking at using a for loop to cycle through a flat file. I have the for loop set up, and the counter's iterating correctly. How do I point at a particular line in a flat file?

Thanks for any suggestions!

Jim Work

View 5 Replies View Related

Trouble With A Multi Record Type Flat File

Jun 19, 2007

I am currently working on project where I need to insert, delete and update data from a text file I receive into multiple tables. So the file has multiple recordset types(50 to be exact) and each record has a a code to perform an -Update, Insert, or Delete to the destination table. Also when I receive the records they are not sorted. I need to sort the sets for each destination table and then read the the sorted set sequentially and perform the correct action.



Currently I am importing the record via flatfilesource into one column. I am using a script component here that would consist I guess 50 outputs including the fields needed for each table. The outputs are sorted by sortkey field and when I add the record to the output I perform data type transforms needed for each field(most are strings but I need to convert some dates, numbers ect..).



***is there a better way of accomplishing this?***

(ps. I could use the conditional split and the derive column into the 50 different table but it was giving me errors that were almost forcing me to use a nvarchar type instead of a varchar type during some of the field transformations.)



At this point I would need to read through each of the outputs sequentially and perform the update, insert or delete into the needed table. Would I have to create 50 script components with an ADO.net recordset adapter to update the tables for each of the outputs? I am hoping you can help come up with a better way to accomplish all of this.



Also if I do need to update the tables with the script component could someone point me to an example of how to programmatically accomplish that. Thanks for any help of suggestions that you may provide as I am feeling kind of stuck.

View 4 Replies View Related

Creating Hierarchical Flat File From Multiple Record Types

May 1, 2008

I'm using SSIS to import seven flat files (each containing a different record type) into a staging database. This part was easy.

Now I need to export the records from all seven tables into a single flat file structured in a nested hierarchy using common keys. (This format is required by the vendor for loading data into a new system).

I could use some ideas on the data transformations needed to combine all seven record types into an hierarchical record set which can then be written to my Flat File Destination. I'm currently looking at an article on SLQIS.com ("Handling Different Row Types In The Same File") which seems close to what I need, but they are importing (ref: www.sqlis.com/54.aspx ). I'm not sure if I should just reverse this for export or use something different. Any comments are appreciated.

Diagram of Record Hierarchy

typeA (parent key, ...)

typeB1 (parent key, childSet key, date, ...)

typeB2 (parent key, childSet key, ...)

typeC (parent key, childSet key, ...)
typeD (parent key, childSet key, ...)
typeE1 (parent key, childSet key, date, ...)

typeE2 (parent key, childSet key, ...)


The record types B1 through E2 form a complete set. Each set has it's own unique child-set key. There may be one or more sets for each typeA record (although it's possible that typeE records don't exist in the most recent set).

View 3 Replies View Related

SSIS: Multi-Record File Extract With 9 Record Types

Feb 26, 2008

I am attempting to create a multi-record file (as described in my last thread) and have found the following set of instructions very helpful:
http://vsteamsystemcentral.com/cs21/blogs/steve_fibich/archive/2007/09/25/multi-record-formated-flat-file-with-ssis.aspx

I have been able to create a sample file with two of my record types.

I now need to build on this further, because I have 9 record types in total that need to be extracted to a single flat file.

does anyone have any ideas how I might extend the example above to include more record types or know of another means of achieving this?

Thanks in advance for any help you might be able to provide.


View 3 Replies View Related

Exportting To A Flat Text File

Mar 25, 2008

Hi, I need to export data from my sql server to a flat text file.

using select I only have the options of delimmited or column aligned, in either case the output file is unicode encoded. I need an ASNI encoded file.

I can create a non Unicode file if I use Import/Export but then the file does not have CR/LF or enf of record mark which I need.

Is there a way to export a flat text file without unicodes and with CR/LF or enf of record mark ?

I was looking into bcp, but I can't seem to find a good sample for this.

thank you

Alan

View 11 Replies View Related

Exportting To A Flat Text File

Mar 24, 2008

I sql server 2005, I need to export to a fixed width text file.

I can do this using import/export wizard, but my output file does not a CR/LF or end of record marker. There is no option to add this. my main reason for using the wizard is because I need to export the file without unicodes, and I can't seam to find any other way. any options?

thanks!

Alan

View 6 Replies View Related

Writing Text To A Flat File

Jul 11, 2007

I have a Foreach loop which scans a table, and gets names of a bunch of procedures, and then back in the foreach loop, they get executed. Im trying to figure out how I can create a sort of log file to say the name of the procedure that is getting executed currently and the current date time stamp onto a flat file. I havent been able to figure this out yet..anyone know how to do this? I grab the names of the storedprocedures from the table and store it in a variable and use the name from the variable to actually execute the stored procedure.

I guess in essence, the question is how do i directly write lines of 'text' (from say a variable) into a flat file.

View 6 Replies View Related

Parsing Text File And Inserting Into DB

Mar 19, 2008

Hello all,
I have a question regarding importing text file data into SQL Server.  I'm hoping someone can point me in the right direction, as my searches haven't turned up anything specific enough.
I'm trying to parse a large (24MB) text file.  It's a fixed-width file, with multiple columns.  I need to parse this file, check if a record already exists, and then import the data into the database.  But I don't need to insert every column.  There's only a few columns from the file I need to insert.  This parsing also needs to occur at regular intervals (daily).
I looked at BULK INSERT, but I can't find an example that uses only some of the columns.  Every example uses all columns, and the file is delimited, not fixed-width.
Is there anything within SQL Server that can accomplish this?  I haven't turned up anything that will solve my problem.  The only other solution I can think of is an application that parses the file for me and inserts the data into the database.  But can I schedule that application to run every night at midnight (for example) through SQL Server?
I'm not too familiar with SQL Server, so I appreciate any help offered.
Thanks,Jay

View 7 Replies View Related

Inserting Data From Text File

Jul 22, 1998

If this is the wrong place for this question, would someone please tell me so. I am new to SQL Server and still feeling out resources. I have a few books on SQL Server but none cover this question.

I have a text file of dates and numbers that I want to insert into a table. There are way too many rows of data in the file to do this by hand.

Question == How can I essentially insert the text file into my table?

Thank you,
Doug

View 2 Replies View Related

Transfering A Flat Text File In DTS To SQL Server

Dec 26, 2006

How do I tranfer a flat file (text) to SQL Server using DTS? Please point me in the right direction.

View 19 Replies View Related

SSIS - Data Flow To Flat File - Insert At Start Of File

Oct 24, 2007

Hi all,

In a foreachloop, I am inserting records into a flat file which is working fine. But the thing is that as the file grows, it takes longer for it to locate the EOF(End of File) of the flat file so as to insert the records.

I have around 70-100 lines written to the file at each loop and there are more than 20k records to be looped. wihich means that at the end I should be having 1400k - 20000k line in the text file.


One solution would be to insert the records at the start of the file itself so that it does not has to lookup the EOF each time before writting.

Another would be to generate separate files and then merge it.

Any idea how can this can be done?


Beside this I have to zip the file and then SFTP to a given address.

Any suggestion or help would be welcome.


Rdgs

David



View 5 Replies View Related

Adding A Header Record To A Fixed Width Flat File Data Export.

Jun 21, 2007

Hi-I have a sql database (2005) that I need to extract a report from that looks somehintg like  SELECT * From Empl_Hours WHERE some_flag <> 'true' .The thing works fine, but the problem is this: I need to insert a record in the 1st row that looks like "Static_text"+row_count() +"more_static_text"where row_count is the actual # of rows that were retrieved. Thanks in advance for any help.DAn 

View 3 Replies View Related

Inserting Data From Text File To SQL ME Table

Nov 24, 2006

Hello,

I have an application taht requires the use of a table. The device that this application works on, has a local memory that does not allow me to insert the 800,000 records that I need. Therefore I have two approaches:

1. To insert less records into my local memory database e.g 40,000 but not row by row, bulk insert is better. How do I do the bulk insert?

2. This is the most prefferable way: To find a way to insert all 800,000 records into a table on the storage card which is 1GB. What do you suggest? Will using threads be helpfull? Any ideas?

I use C# from VS 2005, SQL ME, compact framework 2.0 and windows 4.2.

Thanks in advance,

John.

View 6 Replies View Related

How To Load A Flat Text File Into MSDE / SQL Server

Mar 27, 2001

Hi!

How do I load a comma-delimited text file into MSDE? How does it work for SQL Server 7?

Thanks,
Helmut

View 1 Replies View Related

Export To Flat File - Text Qualifier Problem

Jun 7, 2007

I'm exporting using a query to a flat .txt file. The problem I'm encountering is when I export the data and then open the .txt file into excel some columns cause line breaks to the next row. The columns that are breaking to a new row are varchar fields where the user has entered text into the field with double quotes ".

When I export, I'm using row delimiter {CR}{LF} column delimiter Comma and text qualifier Double Quote (")

Is there a way to prevent this from happening when I export and open the flat file into Excel?

I tried using replace, but I was getting a syntax error in my query. Here is the query without using replace:

SELECT e.session_date, l.lab_no, i.first_name + ' ' + i.last_name AS Teacher,
tt.name, d.district_name, s.school_name, t.title, a.q1 AS Question1, a.q2 AS Question2,
a.q3 AS Question3, a.q4 AS Question4, a.q5 AS Question5, a.q6 AS Question6, a.q7 AS Question7,
a.q8 AS Question8, a.q9 AS Question9, a.q10 AS Question10
FROM evaluation e
LEFT OUTER JOIN training t ON t.id = e.training
LEFT OUTER JOIN lab l ON l.id = e.lab_no
LEFT OUTER JOIN instructor i ON i.id = e.instructor
LEFT OUTER JOIN trainee tt ON tt.id = e.trainee
LEFT OUTER JOIN district d ON d.id = e.district
LEFT OUTER JOIN school s ON s.id = e.school
LEFT OUTER JOIN answers a ON a.id = e.answers
WHERE session_date >= '20070401' AND session_date < '20070501'

I would need to use the replace on columns a.q7, a.q8, a.q9, and a.q10

I tried using another delimiter...pipes (|) and that didn't work? Maybe I was attempting it incorrectly?

Thanks in advance for any help.

View 3 Replies View Related

Reading Past CR-LF In Flat File Text Input

Jul 13, 2007

Hi,



I'm wondering if there is any way to get SSIS to notice, in the Flat File Source, that a "Ragged right" text input file has a record that is too short to populate all the specified columns.



I am reading data from a file that is supposed to be fixed length records, but record 193,591 (out of approx. 500,000) is 20 bytes short of the fixed length (60 bytes). So I changed the input to "ragged right" and found that I can thereby continue to read the file, and load the data (after setting the "maximum errors" to a number greater than the initial "1"). (Without this change to "ragged right", every record after the bad one was "out of synch" with the column arrangement -- so they never made it into the database table destination.)



But the "failures" I am now getting are during the Data Conversion step, when I try to convert some columns to integers (from text, in the input stream). And by looking at the data with a "Redirect Row" setting for the Data Conversion step, I am able to see that the Flat File Source is reading "right past the end of the row."



Is there a way to get the Flat File Source to honor the CR-LF record terminator, and decide that some text columns should contain "nothing" (NULL or zero-length strings), rather than the bytes that contain the CR-LF and the initial text from the next record? Can this somehow be noticed as an error condition?



Dan

View 12 Replies View Related

Transact SQL :: Flat Text File - Separate HTML String

Jun 24, 2015

I have a flat text file with lots HTML tags and corresponding values 

For example 
<Near_Side> 5563 </Near_Side>
<Top_Down_Code> Xe345 <Top_Down_Code> 

So, For example I can use the a function 

ALTER function dbo.StripHTML( @text varchar(max) ) returns varchar(max) as
begin
    declare @textXML xml
    declare @result varchar(max)
    set @textXML = REPLACE( @text, '&', '' );

[Code] ...

To which Select dbo.StripHTML('<Near_Side> 5563 </Near_Side>')  Value 

I'll get 5563

However how would you get the values within the tag itself ? E.g. 

Value Name 
5563 Near_side
Xe345      Top_Down_Code

I was thinking along the Charindex but cant seem to get it right.

View 4 Replies View Related

How To Export To A Fixed Width Flat Text File With Row Delimiters?

Aug 28, 2007

We're having issues exporting a set of data from SQL to a fixed width flat text file by just doing a right click on the DB, then choosing Tasks > Export Data. You can not specify a row delimiter when you choose a Fixed Width format. The only way around this that we've found is to specificy char(13) and char(10) at the end of the SQL select statement. Without row delimiters you end up with 1 giant record rather than 20,000 regular sized records. Is there any other way around this that we're missing?


Using Ragged Right is not an option either since the record lengths will be inconsistent if the last field doesn't contain a consistent length to the data.


Thanks,
Mike

View 16 Replies View Related







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