Auto Insert Msg Files
Apr 22, 1999
Hi,
We will shortly be receiving msg files via MS Exchange and wish to import the data into a temporary table for processing into other tables in the database.
Is there a way that I can get SQL Mail to read the mail and export the message data into a temporary table?
Here is an example of the mail message content:
NAME = xxxxx xxxxxxxxxxxx
ADDRESS = x xxxxxx xxxxxxxxxxx xxxxxxxxxxxx
CITY = xxxxxxxxxxxx
STATE = xx
ZIP = xxxxxxxx
COUNTRY = xxxxxxxxxx
EMAIL = xxxxxxx@xxxxxxxxxx.xx
HOME_PHONE = xxxxxxxxxxxx
BUS_PHONE = xxxxxxxxxxxx
GENDER = xxxxxx
AGE_RANGE = xx-xx
CURRENT_BIKE_MAKE = xxxx
CURRENT_BIKE_MODEL = xxxx
REPLACE_YEAR = xxxx
REPLACE_MONTH = xxxxxxxxxxxxxxxxx
REQUEST_INFORMATION_ON = xxxxxxx
Davy
View 1 Replies
ADVERTISEMENT
Jul 2, 2015
I use management studio on the sql server. Each time i want to run scripts over new data, i have to delete the old files in a database and import new ones (from csv files to .dbo). These are the same files everytime except that the data change. Is it possible to make an automated proces for this import?
View 2 Replies
View Related
Aug 15, 2014
I have set the environment set for AutoRecover (for every 3 minutes and Keep information for 7 days under the SSMS 2014 Menu: Tools -> Option ->Environment -> AutoRecover).
I've rebooted the box and restarted the SQL Server service and nothing seems to create the files.
View 4 Replies
View Related
Dec 19, 2006
I'm populating a table (TMP_SQL) with data from several other tables in our database.
I need to create through SQL commands a counter variable to fill TMP_SQL's KEY1 field. The data I'm pulling in from other tables does not have a field that is always 100% gaurenteed unique, so I need to create a counter for a key field.
Pseudo code:
insert into TMP_SQL(tmp_key1, tmp_general1, tmp_general2, tmp_number1, ....)
select @counter, someColumn, someColumn2, (select column3 from other table returning 1 row),...
from table1 where things = things.
How can I implement @counter = @counter + 1? Is this possible? I tried:
DECLARE @COUNTER INT
SET @COUNTER = 0
and then had @COUNTER = @COUNTER + 1 in my select statement; of course, I got the error about not being able to set variables in the same select as data-retrieval
Computers never do what I tell them to...
View 1 Replies
View Related
Jul 15, 2015
We have the following requirement :
1. In daily basis auto loop through each item in the invoice table.
2. passing invoice number into a Summary SSRS report as parameter.
3. Auto download ALL generated PDF reports into a window folder with a special file name format i.e. <INVOICE_NO>_<DATE>.pdf
how to achieve this via SSRS, Store Procedure or Power Shell?
View 4 Replies
View Related
May 1, 2007
how i make date field in database auto updated,some one told me to use '" Now "' in insert command, but it dos't work, i think it's for asp. regards
View 4 Replies
View Related
Jul 23, 2005
I'm a bit new to SQL Server, but here is the problem I am trying to getaround:1. I have lets say an Employee table where the emp_id is an identitycolumn that is auto assigned by the db.2. I wish to insert values into the tables, but sometimes I may wish touse the value of the emp_id that i supply while inserting (andsometimes not).Is there any way in MS SQL to do this? For e.g. is it setup like aconstraint that I can temporarily drop. I do not want to alter thetable, so that option is ruled out.Any other ways to do this (I know bcp is one of them that allows me todo this, but looking for ways in the db itself using SQL if possible)Thanks,Bharat
View 1 Replies
View Related
Sep 20, 2006
I have the following situation; I have one table (tblA) in which a new record just has been inserted. Once this insert is completed successfully, I want to insert a variable number of records into another table (tblB). The primary key of tblA is being used inside tblB as one of the columns in each insert. I’ve already been able to transfer the primary key, generated by the insert for tblA, pretty easy. But to make things a bit more complicated, the variable number of records to add is being decided by the outcome of a query based on an entry inside tblA (after the insert) and this is then being run on another table (tblC). The SELECT statement from tblC combined with the Select parameter from tblA will then decide how many records I have to insert. Sorry for the (perhaps) confusing way of writing this down, but I’ve been struggling with this for a couple of days now and I really need to get it working. Anybody who can help?Thanks in advance,Sunny Guam
View 3 Replies
View Related
Jun 7, 2006
i am trying to insert an auot number field in my table which has got about million rows but sql 2005 is giving me na error "cant insert"
i need to index my table so that the query runs faster when i perform joins on two of such huge tables..
i tryid inserting the identity key the way it was mentioned in the forum but sql doesnt let me do that??
pls help
View 9 Replies
View Related
Jul 20, 2005
Just when I though I knew what I was doing. I ran into a roadblock.I have two tables, organizations & usersI am building a form online for orgs to input their own information.How do I insert into both tables when the org table needs to know what theuser_id is, but the user_id hasn't been created until the form is submitted?Any help or request for additional info would be more than great.Thanks!
View 1 Replies
View Related
Dec 3, 2005
Hi,
I use the SqlDataSource Control for generating SQL-statements that I
easily can modify. But on some tables I cant autogenerate the
statements for Insert, Delete and Update. The checkbox is dimmed/not
enabled. Why cant I use the autogenerate feature on some tables?
Best regards,
I really like asp.net 2.0!
View 1 Replies
View Related
Aug 31, 2007
I get this error when I look at the state of my SQLresults object. Have I coded something wrong?Item = In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. conn.Open()
Dim strSql As String
strSql = "INSERT INTO contacts (companyId, sourceId, firstName, lastName, middleName, birthday, dateCreated)" _
& "VALUES ('" & companyId & "', '" & sourceId & "', '" & firstName & "', '" & lastName & "', '" & middleName & "', '" & birthday & "', '" & now & "') SELECT @@IDENTITY AS 'contactId'"
Dim objCmd As SqlCommand
objCmd = New SqlCommand(strSql, conn)
Dim aSyncResult As IAsyncResult = objCmd.BeginExecuteReader()
If aSyncResult.AsyncWaitHandle.WaitOne() = True Then
Dim sqlResults As SqlClient.SqlDataReader
sqlResults = objCmd.EndExecuteReader(aSyncResult)
Dim cid As Integer
cid = sqlResults.Item("contactId")
Me.id = cid
conn.Close()
Return cid
Else
Return "failed"
End If
View 3 Replies
View Related
Oct 22, 2015
I have to send updated Employee list from employee master table to a particular email ID on every last date of Month and when a new employee is added / deleted / edited. Also need to send this as an Excel file
I tried the following but "Invalid Object name dbo.tbl_EmployeeMaster" error coming while inserting a new employee.
USE [eXact]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[trg_Email]
[Code] ....
View 8 Replies
View Related
Feb 16, 2014
Since upgrading from SQL Server Management Studio 2008 R2, I've noticed that it no longer autosaves queries that have not been manually saved first. If a file has been manually saved the autorecover files end up in the following directory:
%appdata%MicrosoftSQL Server Management Studio11.0AutoRecoverDatSolution1
However, I have ended up in the situation where I have unsaved queries when my computer has crashed and have not been able to recover them.
I have also found references to .sql files stored in temp files in the following directory, but the files here seem to be very haphazardly caught:
%userprofile%AppDataLocalTemp
View 2 Replies
View Related
Feb 6, 2001
How do I insert images, specifically small .jpg and .gif files, to a remote SQL Server 7.0 database?
Thanks,
Greg
View 2 Replies
View Related
Dec 13, 2013
I have multiple xml files in a directory that i would like to insert into tables. I can perform the action just fine with 1 file...but how do I add all the files in the directory into the same tables...or keep track of the files in that directory and if a new one is added it will be uploaded to the database. I have attached the script I am using to upload 1 file...
declare @XMLdocument xml
declare @doc_handle int
create table XMLfile(surveyXML xml)
bulk insert XMLfile
[code]...
View 7 Replies
View Related
Jun 14, 2007
Do any of you know how to insert files into a Microsoft SQL DB?
Thank you,
Bassobee
View 4 Replies
View Related
Jan 24, 2008
Is there any control flow task or any task in SSIS that is able to get 50 XML files
from a directory on a server and insert them into a table/column of xml datatype
in a sql server database?
I lnow I can use the foreachloop container and specify the directory path to pick up
the xml files but what do you do after that?
I also know of the OPENROWSET Function but that does 1 file at a time only!
??
View 5 Replies
View Related
Mar 6, 2008
I have 60 XML files in the following directory, how do I loop through each one to insert into a table like the code below only does 1 file.
How do I store each filename in a variable and the concatenate it to the following code?
DECLARE @XML XML
SELECT @XML = CAST(BulkColumn AS XML)
FROM OPENROWSET(BULK '\SQLSRV1ConvergCust_21012008.xml' , SINGLE_BLOB) AS x
INSERT dbo.Test.XML (XMLDoc)
SELECT @XML
View 4 Replies
View Related
Jan 23, 2004
I have an MS SQL Server table with a Job Number field I need this field to start at a certain number then auto increment from there. Is there a way to do this programatically or within MSDE?
Thanks, Justin.
View 3 Replies
View Related
Feb 27, 2007
Hi guys!
I've made a simple INSERT form write some records in a database....
then I need to associate to every record a PDF FILE or a WORD FILE..
so who (a user) insert a record should upload a file ....
How could associate the record to the file that an user upload?
classical article pubblication problem...do you know some tutorial?
3rdEyed
View 2 Replies
View Related
Apr 18, 2001
SQL Server 7.0 doesn't seem to support data files for bulk insert that have quoted text fields.
e.g.
" 1","Farmer","Joe","AAA","Smith John","",20001001,
I've tried using the format file to strip out the quotes. But, this doesn't seem to work.
My format file looks like this:
4.2
9
1 SQLCHAR 0 0 """ 0 dummy1
2 SQLCHAR 0 9 "","" 2 EmployeeID
3 SQLCHAR 0 35 "","" 3 LastName
4 SQLCHAR 0 35 "","" 4 FirstName
5 SQLCHAR 0 10 "","" 5 Category
6 SQLCHAR 0 35 "","" 6 Supervisor
7 SQLCHAR 0 5 ""," 7 OpCode
8 SQLCHAR 0 8 "," 8 HireDate
9 SQLCHAR 0 8 "
" 9 TermDate
Any idea on how I can bulk insert a data file where some of the fields are qutoed.
View 2 Replies
View Related
Aug 9, 2006
I used bcp to produce the apended format file.How can it be modified to recognize the quotes that surround the textfields and not insert the quotes along with the text? Invariably, thefirst four columns have text surrounded by quotes and are terminated bytabs. If the first column has "abc", only abc ought to be insertedinto that field in the table.ThanksTed==================format file========================<?xml version="1.0" ?>- <BCPFORMATxmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">- <RECORD><FIELD ID="1" xsi:type="CharPrefix" PREFIX_LENGTH="2" MAX_LENGTH="6"COLLATION="Latin1_General_CI_AI" /><FIELD ID="2" xsi:type="CharPrefix" PREFIX_LENGTH="2" MAX_LENGTH="7"COLLATION="Latin1_General_CI_AI" /><FIELD ID="3" xsi:type="CharPrefix" PREFIX_LENGTH="2" MAX_LENGTH="48"COLLATION="Latin1_General_CI_AI" /><FIELD ID="4" xsi:type="NativeFixed" LENGTH="4" /><FIELD ID="5" xsi:type="CharPrefix" PREFIX_LENGTH="2" MAX_LENGTH="8"COLLATION="Latin1_General_CI_AI" /><FIELD ID="6" xsi:type="NativePrefix" PREFIX_LENGTH="1" /></RECORD>- <ROW><COLUMN SOURCE="1" NAME="f_supplier_code" xsi:type="SQLVARYCHAR" /><COLUMN SOURCE="2" NAME="f_product_code" xsi:type="SQLVARYCHAR" /><COLUMN SOURCE="3" NAME="f_product_name" xsi:type="SQLVARYCHAR" /><COLUMN SOURCE="4" NAME="f_asset_classes_id" xsi:type="SQLINT" /><COLUMN SOURCE="5" NAME="f_size" xsi:type="SQLVARYCHAR" /><COLUMN SOURCE="6" NAME="f_dist_unit" xsi:type="SQLFLT8" /></ROW></BCPFORMAT>
View 6 Replies
View Related
Apr 9, 2008
how do i insert a large chunk of text into a table column. my project is to build a news website. where people can go and read news articles. the articles are provided by the author in word format, so how do i insert that news article into the table's column? any help would be appreciated
thanks
View 2 Replies
View Related
Mar 23, 2014
We are facing a problem with loading data from .pdf files from vendor..pdf files have data in tabular format and we would like to insert those fields into a SQL table.We do not want to insert the physical location of the file but, we need to insert the data within the file.How can we read a pdf file?
View 6 Replies
View Related
Feb 24, 2008
Hello,
I need to create about 1,000 (literately) Excel files that each contain 5 tabs. The data being placed on the tabs will always be the same (meaning the columns are static).
I am fairly advanced at Excel VBA so I can write code that does all the following in Excel (looped 1,000 times):
Open an Excel template
Bring data in from the tables
Filter, then copy-paste the appropriate rows into each tab.
Save the new Excel file.
Email the file to appropriate individual (it is a Microsoft Exchange Server).
As I started this in VBA, I thought that I might be able to do it with SSIS. My concern is I need to have the rows formatted (font, border, etc.) and the number of rows change.
My questions are:
Is it possible to format Excel with SSIS?
Can I email the files even if it is not with an SMTP protocol?
Would SSIS process this data faster then Excel?
Does this approach even make sense? Am I better just doing it with VBA?
Thank you for the help.
-Gumbatman
View 4 Replies
View Related
Feb 24, 2015
My task is to convert jpeg's to binary and then insert them into a table called "images". I need to convert/insert all jpeg files in a directory. I'm able to accomplish the task if the files are numbered. The query below works by retrieving one file at a time based on the value of @i. However, I also have directories where the files are not numbered but have ordinary text names like "Red_Sofa.jpg". I need to iterate through these directories as well and convert/insert the jpeg's. I'm running SSMS 2014 Express on 4.0 and Windows 7.
DROP TABLE images
CREATE TABLE images
(
image_name varchar(500) null
,image_data varbinary(max) null
[Code] ....
View 2 Replies
View Related
May 6, 2015
I have a requirement to
a. Read data from Different CSV files.
b. insert and update data to Data base in multiple table using joins.
This execution runs for 1-2 hours.I can use C# with Ado.net, but only concern I see is if in between execution fails due to some connection or other error. All insert data has to be cleaned up again.I feel writing and Store procedure inside transaction, which will take path's for CSV file as input and insert data in database. using transaction we will have flexibility rollback to original state.
View 9 Replies
View Related
May 6, 2008
I'm running this procedure which insert into table_name(id, name.....) select id, name.... from table_name. For some reason the tempdb data file grow up to 200GB. The tempdb is set to expand unrestricted by 10%. How can I prevent that from hapening? Thanks.
View 5 Replies
View Related
Sep 21, 2006
It seems to me that files created on Unix machines with line terminator , or chr(10), cannot be imported using the Bulk Insert statement. Is this a bug, or an oversight by Microsoft? Does this mean that unless one replaces all with
, there is no way to use Bulk Insert to import Unix files? This is a very strange behavior by MSSQL. Even lessor programs such as Excel and Word automatically recognize chr(10) as a line termination character. Am I missing something, or is this just the way MSSQL is?
View 7 Replies
View Related
Feb 15, 2008
I need to be able to bulk insert a bunch of tables from their corresponding flat file. I have created an XML file (see below) which has the file name/table name pair at each node. I then created a ForEachLoop task and used the Node enumeration type and the following OuterXpathString: ReferenceFiles/File. At this point I get lost. How do I pass the 2 inside node values (file name and table name) to variables which I can then use as expressions for the bulk insert task inside the Foreach?
Here is XML file:
Code Snippet
<ReferenceFiles>
<File>
<FileName>Ref_Categories.txt</FileName>
<TableName>Ref_Categories</TableName>
</File>
<File>
<FileName>Ref_Configs.txt</FileName>
<TableName>Ref_Configs</TableName>
</File>
</ReferenceFiles>
Thanks.
View 1 Replies
View Related
Jan 9, 2015
I proposed on a new server that we separate Data Files, Log Files, tempDB, Backups, etc. onto separate LUNS on a SAN with High Speed Solid State Drives.I was told that with the new technology with solid state SAN's that it would decrease performance and that it did not work the same way as it did when you had RAID 5's etc.I thought that if things were cared out correctly by a SAN Administrator they would know how to configure for optimal performance.
View 2 Replies
View Related
Mar 13, 2008
In the For Loop, How to Iterate from Older flat files to Newer flat files based on File's Timestamp. If there are some older files in that folder, it should be processed first and then continue with the newer one.
Any Suggestions?
View 3 Replies
View Related