Retrieve All The Filename Present In One Particular Location In SQL

Dec 20, 2007



Hi,

I need to read all the text files present in one particular folder and have to place all the contents in the file into a table. I will be knowing the location of the file but i will not be knowing the name of the file. I am using a BULK INSERT command to place all the contents to a table.
Eg: BULK INSERT TEST FROM '\BSSC018C$IP Office LogsLog 20071206 000000 (5).txt'
To use BULK INSERT i have to specify the location of the file with the filename. So can anyone please help me to know how the names of the file can be fetched through SQL query. If i am able to get all the file names i can use a cursor and insert all the datas from all the text files.

Thank you.

View 18 Replies


ADVERTISEMENT

Effectively Getting Data And Present It By Location

Jun 16, 2008

Hello. I have been challanged to build an application that keeps track of inventory and dates of every item that needs inspection on regular intervals. The original application was a .NET windows application and i have been tasked to "port" and improve it to a .NET C# web application.
The original database was in access and i have imported everyting to SQL and all the data is in a single table. So far the table is relatively small so i decided to keep the current database design.
What i need to do is to select all the items that are comming up for inspection in the comming months and present them. Each item has a uniqe article number (artnr) with the item name, category and location of the item. The location is the part i would like each items to be presented by. Basicly i would like to retrive artnr, name, type and present x number of gridviews or a sorted presentation where each item is shown inside each gw/whatever by location.
I also considered moving all locations to it's own table and connect it with a PK/FK to the prinmary article table but i dont know if this will help me or not. Basicly i have no idea how i would present the items by location where each gridview/somethign else is it's own location.
I could really use som help with how i can retrive and present the data so it is showed in the above manner.

View 1 Replies View Related

Retrieve Date From Filename

Apr 29, 2006

Hye all,

I need help on this.

Let say my source file in excel format. Currently i'm using foreach loop to execute those source files. The problem is that , i want to retrieve a date from the source(filename) itself. i've tried using derived column. but it doesnt work.

eg: Source file name Email_Jan_05.xls, i want to grab the string JAN and 05 which later i'm going to put it in my database.

any suggestion? Thanks in advance.

View 4 Replies View Related

How To Concatenate Variables For RAW Output Filename I.e.@path + @filename?

Sep 7, 2007

Doesn't appear you can do this.

Am I wrong?

Please tell me I am.

View 11 Replies View Related

SSIS Execution Error: FlatFile Connection Problem - FileName &&<fileName&&> Specified In The Connection Was Not Valid.

Apr 19, 2008



Hi Champs,

Scenario Configuration : VB.net 2005 Code, WebService for Executing SSIS on Server, SSIS deployed on the Database Server

Problem Description : We are developing windows applicaiton in which we call webservice which was deployed on the same server where SSIS packages are deployed.
Now from Code we are passing FilePath name in variable and execute the Package. But the SSis result says that
The file name "\computernamefol1fol2fol3fol4abc.txt" specified in the connection was not valid.

More Information:

1. Full Permission are given on this network folder.
2. Package executes successfully from SSIS development solution (BIS solution)
3. Deployed packed executes successfully from the Database Server.
4. From Development pc packege executes successfully.
5. Other packages deployed on the same server executed suucessfully with same configuration and scenario.

Only this package is not executing.


-- the only differece with this package with other is -

using ".txt" extension in Flat file connection and using VB Script task


Can any one suggest the appropirate solution for this problem...

Thanks
Tarang Pandya

View 21 Replies View Related

How To Insert A Row Only If It's Not Present

Apr 16, 2008

Hi,

I've been asked to find a way to insert a row only if it's not present. I want to make sure that test and insert are atomic, so I wrote the following test cases


-- CREATE TABLE t1 ( id int, val varchar(256) )

-- GO


-- Execute the following statements in one query window

IF NOT EXISTS(SELECT * FROM t3 WHERE id = 1)

BEGIN


WAITFOR DELAY '00:00:10'

INSERT INTO t3(id, val) VALUES (1, 'Query 1')

END

GO


-- Then execute the following statements in a second query window within ten

-- seconds of the starting the first query

IF NOT EXISTS(SELECT * FROM t3 WHERE id = 1)

BEGIN


WAITFOR DELAY '00:00:10'

INSERT INTO t3(id, val) VALUES (1, 'Query 2')

END

GO


When both queries are complete there will be two rows in the table t with id = 1.

1 Query 2
1 Query 1

Wrapping the code in a transaction does not change the result. Changing the transaction isolation level to serialable causes a deadlock, but otherwise the isolation level has no effect on the result either. Adding a WITH (TABLOCK) hint to the tests do not change the result.

Our clients use a mix of SQL 2000 and SQL 2005 so TRY/CATCH blocks cannot be used.

Any suggestion on how to do this?

Thanks

View 11 Replies View Related

The Given Key Was Not Present In The Dictionary

Feb 4, 2008



I'm developing a report which contains a number of matrixes which are ordered in a hierarchy which can be navigated using a document map. One of the matrixes contains a subreport containing a table which displays a description for the matrix and the corresponding document map label. This is working without problem already in the production environment.

Recently, after updating my machine with numerous updates and patches, this stopped functioning. I now receive the error message, "The given key was not present in the dictionary" when I run this subreport, either as part of the greater report or on its own.

I have seen the posting which recommends deleting the report.rdl.data files. This did not solve the issue.

The data and the dataset are both in sync. When I click the "Print layout" button when previewing the report in Visual Studio .Net 2005, I can view the data. This looks like a bug in the VS.NET 2005 report designer.

I am running SQL Server 2005 SP2.

Any help is appreciated.

Regards,
Bill Mueller

View 3 Replies View Related

Not Present On The Subscriber.

Dec 11, 2006

Hi all,

Publisher
SQL 2000 Snapshot publication timed to run at 23:00 daily All tables & views are published articles.Snapshot agent runs and creates a snapshot of all articles.

Subscriber
SQL 2005 Pull subscription set to run continuously Manually run the SQL agent job and I get the following error... 2006-12-11 15:04:35.687 Agent message code 20164. Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber.

I've tried creating the subscription database from a backup so I know all the tables & views exist and also tried just creating a blank empty database - same error.

There are no user stored procedures or functions in the database.

If I'm publishing all tables & views then why should the data & structure fail to load at the subscriber? Do I need two publications, the first containing the metadata and the second containing the data?

Thanks in advance
Dave

View 6 Replies View Related

Cascade Deletions Of Children When FKs Present

Dec 8, 1999

Guys, could anyone tell me if MSSQL Server 7 has 'on delete cascade' option when creating a foreign key constraint or something similar to it. I'd really like MSSQL to remove all dependent records (child records) automatically from one table when I'm deleting a parent record from another record. I know that I can do it via trigger, but the FK constraint should be removed or disabled. I would really appreciate your help. Thank you very much.

View 1 Replies View Related

Is Connect BY Clause Present In SQL Server ?

Feb 16, 2007

Hi,

We need to create a tree stucture output of a query.
In case of Oracle , there is 'CONNECT BY' Clause for creating the same.

Does SQL server support anything of this sort?

If yes, can anybody please provide the syntax for the same?

Regards
Kiran

View 4 Replies View Related

Selecting The Records In The Present Week

Dec 3, 2007

Dear All,

I want to retrive the records if are created in a particular week.
if i pass 03/12/2007 , i want get records which are created in that week

View 11 Replies View Related

How To Present Time Series Chart On The Web

May 28, 2006

Help me!!

1. Can you tell me the way to present Time Series Chart on The Web by ASP.Net 2.0
2. I have a Time Series Mining Model. Its structure is:

(Month datetime key time, Sales continous predict)

When the query runs:


select Flattened  Predict(sales,5)

from Model_Name
The result is Month and sales in the future. But i wan also retrieve Month and Sales in the past . Tell me the way?????

Thank alots!!!!!!!

View 4 Replies View Related

Reporting Services :: The Given Key Was Not Present In The Dictionary

Jul 5, 2006

When I try to preview a SSRS report in VS 2005 I get the following error: "The given key was not present in the dictionary", however when I deploy the report and view it in the Report Manager all is fine. I have not been able to find any useful info in MSDN, what I can try?

View 8 Replies View Related

Checking Whether Particular Field Present In The Result Set

Jul 17, 2007

Hi,

I have one dymic report and one of the requirement is that,I want to check whether particular field is present there or not



For e.g In one of the case Fields!Name will come and in other case it won't.

There one dynmic column which calculated values based on all the column.



If I write in value field of this column as follows.[If status = "Name" and Field is not missing then take Name value,if field name is Consumer take value from Consumer and shows it in column.]



=Switch(Fields!portfolio_status.Value="Name",IIF(Fields!IName.IsMissing,"0",Fields!Name.Value)

,Fields!portfolio_status.Value="Consumer",IIF(Fields!Consumer.IsMissing,"0",Fields!Consumer.Value))





In case,portfolio_status doesn't give me value "consumer" then I expect "0" to get printed.Problem here is that IIF expression tries to evaluate Fields!Consumer.Value even if it is not using this value and because of that my calculated column is not working.

I tried IsMissing,IsNothing..Nothing seems work.Basically I want to check if that field is there in result set or not.



IIF(IsNothing(Fields!Consumer),"0",Fields!Consumer.Value)

IIF(Fields!Consumer.Value Is Nothing,"0",Fields!Consumer.Value)

View 1 Replies View Related

RMO ERROR : No Signature Was Present In The Subject.

Jun 7, 2007

Hi !

I have such a message after trying to do replication with SQL Server 2005 using custom Business Logic Handler for a Merge Article (RMO Programming).

Message Replication-Replication Merge Subsystem: agent 'job' failed. No signature was present in the subject.

I am using C# with RMO, merge replication.

Any ideas ? How to solve this problem ?

Thanks.

View 2 Replies View Related

Can't Login Remotely Even Though Membership Data Is Present

Dec 18, 2006

(Sorry this was posted to VWD2005 Express by mistake)
I have created a simple project using ASP.NET 2.0 which enables a user to login. I created the login user using the Web Administration Tool in Visual Studio 2005.
I created everything locally and it worked.
Locally I have 2 databases. One containing normal data (which my site uses to populate a GridView control) and the other being ASPNETDB.MDF - which contains membership (login user) data. These 2 databases sit in the App_Data folder which is in the root of the project.
I have a remote database which is hosted in a shared environment.
This is just the one database and it appears to have all tables in the one database (membership tables and normal tables - such as the one I use to populate my GridView control).
I uploaded the website and using the Database Publishing Wizard I uploaded the database data to the shared host. I also changed the connection string to point to my remote database.
If I visit the website the GridView is populating correctly (pulling data from the remote database) but when I try to login it crashes. The error is "Access denied creating App_Data sub directory".
The membership login details for the user I created are in the remote database as I have compared the data in it to the data in my ASPNETDB.MDF local database.
If I launch from within Visual Studio 2005 then it allows me to login perfectly well.
Please does anybody know why it won't let me login when I access it via the website?
Many thanks for any help,
Graham

View 3 Replies View Related

How Check Either One Name Of The User Is Present Or Not In Data Table From C#.net

Jan 31, 2008

hi
 can anyone help me out, i have one issue that is how i have to check while adding new user details to database table weather that user name is exist in that table or not.
for my application i'm using oracle database and C#.Net.
table is g_users and columns are:
 Name                                      Null?    Type ----------------------------------------- -------- ---------------------------- USERID                                    NOT NULL VARCHAR2(5) NAME                                               VARCHAR2(20) EMPID                                              VARCHAR2(5) USERNAME                                  NOT NULL VARCHAR2(30) MOBILE                                             NUMBER(12) EMAILID                                            VARCHAR2(20) DOMAIN                                    NOT NULL VARCHAR2(30)
i need to check from c# programming before inserting a new row into table weather username is already exists are not. how to check this one?

View 5 Replies View Related

Invalid Attempt To Read When No Data Is Present.

Apr 23, 2008

I'm writing my first .net app in VB.net.  I can connect to my database, but get the following error when I try to set a label value.  (My code is listed below)  What am I missing? 
Exception Details: System.InvalidOperationException: Invalid attempt to read when no data is present.Source Error:



Line 19:
Line 20: reader = comm.ExecuteReader()
Line 21: EmployeesLabel.Text = reader.Item("tkinit")
Line 22:
Line 23: reader.Close()
 <%@ Page Language="VB" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim conn As SqlConnectionDim comm As SqlCommand
Dim reader As SqlDataReaderDim connectionString As String = ConfigurationManager.ConnectionStrings("IntegratedDataConnectionString").ConnectionString
 conn = New SqlConnection(connectionString)
 comm = New SqlCommand("Select top 1 tkinit from tEliteTimeKeep", conn)
conn.Open()
 
reader = comm.ExecuteReader()EmployeesLabel.Text = reader.Item("tkinit")
 
reader.Close()
conn.Close()
 End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"><title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
 
<asp:Label ID="EmployeesLabel" runat="server" ></asp:Label>
 
</div></form>
</body>
</html>

View 3 Replies View Related

Invalid Attempt To Read When No Data Is Present.

May 16, 2008

My query actually returns rows but when I run, I get this error "Invalid attempt to read when no data is present". It says that the datareader does not return any rows.
Please help.
Thanks in advance
Sangita

View 5 Replies View Related

How To Present An Unknown Number Of Columns And Their Names

Aug 14, 2001

I've got a database with an unknown number of columns. Hence, the column names are also unknown. What's the easiest SQL to present the values in each column and the column headings?

View 1 Replies View Related

Delete Records In SQL Table, Which Are Present In Excel

May 5, 2006

Hi everyone,

I have a task to create a dts package, which will delete records in a SQL table, which are present on a sheet tab in Excel. I know how to transfer records from Excel to SQL table and vice versa, but not sure how I can delete the records in SQL table, which are present in Excel. Note that there are just 2 columns - one is a key and the other name.

Thank you all in advance,
Saurav

View 1 Replies View Related

Join Between Two Tables Where Asset Tags Are Present

Dec 20, 2012

There are two tables A and B where asset tags are present, but in one table in rows and in another in column wise.

for eg
ASSet Tag
SR-062009-00032966
SR-062009-00032962
SR-072009-00020572
SR-072009-00020571
SR-072009-00020585
HH-092009-00038342

Table B
field 1 -->Asset TAG
Record 1-->SR-072009-00020572,SR-072009-00020571,SR-062009-00020685,SR-072009-00001592,SR-072009-00001376,SR-062009-00020683,SR-092009-00001617

field 2 --> Material code
REcord 1-->121
REcord 2-->123

What is the query so that asset tag of A matches with each and every asset tag table of B and output comes as

Output
Asset TAg -------- MAterial Code
SR-062009-00032966
SR-062009-00032962
SR-072009-00020572 ------121
SR-072009-00020571 -------121
SR-072009-00020585

View 5 Replies View Related

T-SQL (SS2K8) :: Query Result To String And Present In New Row?

Oct 21, 2015

I have made following code:

I want to make a string from "TarLang.AppendText(String.Format("{1}" & vbCrLf, r("Source Language"), r("Target Language")))" and the result I get when I use that.

add the result into a new row in the datagridview

Dim CompanyID As String
CompanyID = OrderNR.SelectedItem.ToString()
SQL.ExecQuery(String.Format("SELECT snSrc.kod as 'Source Language', snTrg.kod as 'Target Language' FROM [teknotrans_dev].dbo.OpusOrderrow as ord INNER JOIN [teknotrans_dev].dbo.OrderVolvoLanguageName as snSrc

[code].....

View 2 Replies View Related

Invalid Attempt To Read When No Data Is Present

Nov 1, 2006

I have a stored procedure that inserts a record, and then either returns an error or, when successful, returns the entire row. This is a method I use on sites I have developed in other languages when inserting or updating data; I am new to c#.

With C# I have a datareader executing the sp, and the insert works fine, however I get the error "Invalid attempt to read when no data is present." when I try to read the data that should be coming back. I have researched and updated my code so that I no longer get the error, but I still cannot get the data back. I trap the sp in profiler, ran it in anaylzer, and it works fine - data is returned. But in the code, it does not see the data.

I have modified the return results so now I just have the ID coming back and that works fine. But I would rather just return the entire row. Can this be done, and if so, how?

Thanks.

View 3 Replies View Related

Do Nto Send Scheduled Report When No Data Is Present

Jan 2, 2007

Dear Friends:

Could somebody please help me to stop sending scheduled report when no data is present in the report? Actually I have a daily report which is sent to the client and in a week, two or three days, data will not be there and thus it delivers blank report to the client.

So how can I stop sending blank mails to the client?

Thanks in Advance

Emmanuel Mathew

View 1 Replies View Related

Invalid Attempt To Read When No Data Is Present

Jul 25, 2007

I am using a standard dbreader type of loop in a query to retrieve data. I am running over what should be end of record set, every time.



I have altered my read procedures to use while dbreader.read() and if dbreader.read(), to attempt to avoid getting the error. Neither is stopping it.



While debugging it, as I get to the last item and actually get the error, if I check the dbreader status, it still indicates that it has rows.



Anyone have any ideas on how to get around this?



TIA, Tom

View 3 Replies View Related

Query Designer Toggle Button Not Present

Feb 15, 2007

When I create a Report Server Project Using Visual Studio 2005 with SQL Server 2005 I can create a data source with no problem and the test shows it is good good.

When I next create a report and go to the query builder using that same data source and click on the query builder button I see the Query Builder screen, but there is no toggle button in the top left of the screen so I cannot go into the graphical mode to see the tables.

I have uninstalled and reinstalled both Visual Studio and SQL Server but I still have the same problem. What should I do to get the button visible on the screen?

Can anyone help?





View 3 Replies View Related

Invalid Attempt To Read When No Data Is Present?

Sep 26, 2006

when execute

If IsDBNull(sqlreader.GetValue(i)) Then

Error info:Invalid attempt to read when no data is present

but i am sure there were records

Any ideas? Regards

View 2 Replies View Related

How To Present Database In Excel File Using ODBC Connection In ASP.NET

Dec 6, 2007

Hi All, Please help me how to proceed from this situation, my requirement is to present (load) data in excel file and need to access (update/delete) it, the data which is in remote server; I want to connect database using odbc connection through ASP.NET. Please suggest me how to continue.
Thanks to all in Advance.
kolags@hotmail.com
 

View 1 Replies View Related

Error: Invalid Attempt To Read When No Data Is Present

Jan 3, 2008

I am getting this error even though there should be data present.  When I test the SQL statement in query analyzer, it returns 1 row.
<%@ Import Namespace="System.Data.SqlClient" %><%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Blog" %>
<script runat="server">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strConnection As String = System.Configuration.ConfigurationManager.ConnectionStrings("currentConnection").ToString      'currentConnection is defined in web.config and works when used in other pages on the siteDim dbConn As SqlConnection = New SqlConnection(strConnection)
dbConn.Open()
Dim strSelectCommandFirstEntry As String = "SELECT MAX(blogEntryId) as maxID FROM site_Blog"Dim cmdFirstEntry As SqlCommand = New SqlCommand(strSelectCommandFirstEntry, dbConn)Dim rdrFirstEntryData As SqlDataReader = cmdFirstEntry.ExecuteReader()Dim strFirstEntryData As Int32 = rdrFirstEntryData(0)       'error occurs here, i have also tried rdrFirstEntryData("maxID") with same errorrdrFirstEntryData.Close()dbConn.Close()
</script>
When debugging this code and stopping on this line:
 Dim strFirstEntryData As Int32 = rdrFirstEntryData(0)
rdrFirstEntryData has the following values:hasRows = True, FieldCount=1,  Item=In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.   and when i click the refresh button...Item = Overload resolution failed because no accessible 'Item' accepts this number of arguments.
I suspect that the note for "Item" is my clue to the source of the problem, but I don't know what it means.  Please, help.

View 2 Replies View Related

Error:Column 'FieldName' Is Constrained To Be Unique. Value '0' Is Already Present

Jan 18, 2008

Hi,
Can anyone help me?
when I am inserting a record to a dataset I am getting  Column 'FieldID' is constrained to be unique.  Value '0' is already present.
I have 2 fields in table like FieldID,FieldName where FieldID id is Primary key and identity column
I am not inserting any value to FieldID as it is identity column.
DataRow newDR= dbDataSet.Tables[strTable].NewRow();for (int i = 0; i < e.Row.Cells.Count; i++)
{ if ( e.Row.Cells[i].Key != "FieldID" )
{if (e.Row.Cells[i].Value != null)
{
newDR[e.Row.Cells[i].Key] = e.Row.Cells[i].Value;dbDataSet.Tables[ strTable].Rows.Add(newDR);
}
}
Some times it is woking fine with out any error............
 
thanks..

View 3 Replies View Related

Searching The Keywords In A Collection Of Views Present In A Database

Jun 17, 2008

Hi All,
i have some views in my database, and these views are having some columns,i want to know particular column name to be there in particular view.
For example ,just like functionality of sp_search_code 'Keyword'.
like this i want to search in views .
or else please let me know  sp_search_code 'Keyword'. was used for views also.
Thanks and  Regards,
G.JaganMohanrao.
 
 
 

View 2 Replies View Related

Invalid Attempt To Read When No Data Is Present Using SQLdatareader

Jul 2, 2004

I'm trying to determine if the record is NULL/empty or is valid from the datareader.

objReader = strCMD.ExecuteReader
objReader.Read()
if objReader.IsDBNull(0) = true then...

If NULL/Empty, display no records found. If records are found, display "1 or more records have been found". I keep getting the error "Invalid attempt to read when no data is present". I'm not sure what I am doing wrong here.

View 4 Replies View Related







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