I have few data in excel files .. I have to export the data to an sql server database ..
I tried using and import/export wizard from the sql server .. the problem is :
My excel has a field called PCode it contains alphanumeric data .. the rows which has alphanumeric data return "" where as if the Pcode is only numeric 4546 it takes it ..
Here is the structure of the Target Sql Server Table
and here is the Excel file http://www.zuhaib.in/test.xls
I then use the XML source connection to connect to it. It sees all of the columns correctly, but when i run and put a watch on it, or try to output the results to a .csv file, no records come through.
Any ideas on why there aren't any rows comming through? i'm using SQL2005 with no SP1
Whilst reading in records from an excel source via the SQL command method I've stumbled across a problem.
my SQL query takes in all records where the date column is not NULL, this ensures that only populated rows are obtained. If the date is in a format that is incorrect i'd really like the whole data flow to fail. However... What seems to happen is that any rows with a fault in the date column are just missed out and not pulled through the pipeline. I have tried changing the error output from fail component to ignore error and redirect row but nothing seems to catch it.
Does anyone have any suggestions as to why this may be the case?
I am making my first attempt at creating a script for a Script Task. The script needs to do the following;
1. find the length of each record in a single fixed width flat file -file location; C:LearningSettlementDataTestSC15_CopiesSingleFile -file name; CDNSC.CDNSC.SC0015.111062006 (no file extension) 2. if a record is found that is longer than 384 characters; a. copy the record out to a text file -location;C:LearningSettlementDataTestSC15_CopiesErrantRecords -file name; ErrantRecords.txt b. delete record from the flat file where the record length is > 384.
If I can get this to work on a single file, I want to implement it with multiple files. I would imagine that using a ForEachLoop container with the script task 'inside' would be the way to go for multiple files. I have a connection manager set up for the single file and a MultiFlatFile connection manager set up for the whole collection of files. All of the files have the same schema. I don't know if the connection managers are going to be useful to me with what I'm trying to do, but I have them set up.
If you have some input on where I can find resources on how to do this, or have some code to pass along, please share.
I got a problem with the records returned by inner join query. It is weird as in table a I with records r1, and in table b with records r2 (r1>r2), but the returned record number r3 is greater than r1? That is so strange. As the reasonable records returned should be less than r1?(inner join on attribute a). What probably is the cause of the problem? I am looking forward to hearing from you and thank you very much.
I€™m suffering a queer behaviour when I use BIDS. Concretely, when I open a dtsx from my project (it has 10 packages) many times Sequence Container and Data Flow tasks are invisible. I mean, its lines are not visible at all whereas its titles are. I mean, what you see is just a white box€¦
Then, I€™m gonna Data Flow layer and I have to do double-clik over the tasks and are visible but on Control Flow I don€™t see how to solve.
Curiously in our development and production server such behaviour doesn€™t happen (we are accessing by mean Terminal Server from our workstations)
How odd!. Everything is fine except this.
I want to remark you that such project has been copied from the server, this is, these packages are been built on the server
writing the query for the following, I need to collapse the continuity. If the termdate for an ID is one day less than the effdate of the next id (for the same ID) i need to collapse the records. See below example .....how should i write the query which will give me the desired output. i.e., get min(effdate) and max(termdate) if termdate is one day less than the effdate of next record.
I have a situation where deleting old records is blocking updating latest records on highly transactional table and getting timeout errors from application.
In details, I have one table called Tran_table1 in OLTP database. This Tran_table1 is highly transactional table, it will receive data for insert/update continuously
While archiving 2 years old records from Tran_table1 into Tran_table1_archive in batches(using DELETE OUTPUT INTO clause), if there is any UPDATEs on Tran_table1,these updates are getting blocked and result is timeout errors in application.
Is there any SQL Server hints to avoid blocking ..
declare @table table ( ParentID INT, ChildID INT, Value float ) INSERT INTO @table SELECT 1,1,1.2
[code]....
This case ParentID - Child 1 ,1 & 2,2 and 3,3 records are called as parent where as null , 1 is child whoose parent is 1 similarly null,2 records are child whoose parent is 2 , .....
Now my requirement is to display parent records with value ascending and display next child records to the corresponding parent and parent records are sorted ascending
I have been trying to solve the locking problem from past couple of days. Please help mee!!
Scenario: -------------- I have a SSIS package in which 2 data flow tasks. 1st data flow task deletes records from a 5 tables and the 2nd data flow task should insert records into 1 of the five tables after the success of 1st data flow task. This scenario runs in Transacation.
The above scenrio in the 2nd data flow task hangs in runtime. It does not complete. with sp_who2 command i could see that there is an intent share lock(LK_M_IS) on the table and the status is SUSPENDED.
I dont know how to come out of this locking. Please help.
hi guys, Can anyone advise me how how to read an excel doc i have stored locally? I need to be able to start the read from say row number 6 and finish the read once i get to a row that contains a pre-determined word signifying the end of processing. I intend to store the parsed data in an array that will be used as the data source for a gridview or repeater object on another asp page. I'm using ASP.net 2.0 and C# by the way. thanks in advance for any help!!!
Dim objCon2 As New SqlConnection() objCon2.ConnectionString = "a standard connection string" objCon2.Open()
Dim objCommand As SqlCommand objCommand = New SqlCommand(strSQL, objCon2) Dim objReader As SqlDataReader objReader = objCommand.ExecuteReader()
Label1.Text = objReader("email")
strSQL is a select command which I've checked (using SQL Query analyzer) does return data. I know the connection string is valid (and I presume if it wasn't that it'd fail on objCon2.open, which it doesn't).
So why oh why do I get this error on the last line (and yes, there is an "email" field in the contents of the reader)
System.InvalidOperationException: Invalid attempt to read when no data is present.
I have this code that I hacked together from someone else's example. I kind of understand how it works. I just don't know if it will and i am not in a location right now to check. I was wondering if I did this correctly first, second how can it improve and should i do something different. Basically i just want to check the password in a database. I am passing the username and password to this function from another functioprivate bool authUser(string UserName, string Password){ string connectionString = ConfigurationSettings.AppSettings["DBConnectionString"]; SqlConnection DBConnection = new SqlConnection(connectionString); bool result = false; DBConnection.open() SqlCommand checkCommand = new SqlCommand("SELECT password FROM Users WHERE userName='" + Password + "', DBConnection) SqlDataReader checkDataReader = checkCommand.ExecuteReader(); if(checkDataReader.GetString(0) == Password) { result = true; } else { result = false; } checkDataReader.Close(); DBConnection.Close(); return result;}Thank you Buddy Lindsey
Does anyone know how to read transaction log besides trace and profiler. The current situation is some one in our org. deleted an item and I'm trying to find out who and when.
I have some records that have been deleted. I need to find out who did it and to do that I need to read the logs. Are there any utilities that will allow me to read login 7.0? How about 6.5?
We are having continual problems with our transaction log filling up on one of our major applications. Does anyone know of a way or tool to read the transaction log? We want to determine what is causing this problem.
Is there a way, in SQL 7.0 to print out or view what's in the Transaction Log? In 6.5 you could view the table syslogs, but I don't see any documentation anywhere on how to do this in 7.0.
I received a SQL Server 6.5 database (.dat file) on a removeable drive. I'm currently running 7.0. Is there any way to read/import/link to this data without installing 6.5. And if I have to install 6.5 how do I get the system to see the database?
Anyone know a way to read DTS packages? I have inherited a DTS package, saved in SQL, and am trying to find a way to read the steps without having to view every single step through the GUI.
I am storing one text file on the server.This text file contains some mobile numbers.The file look like 009198XXXXXXXX 009198XXXXXXXX 009198XXXXXXXX 009198XXXXXXXX etc
Here I need to read this text file row by row mobile number and then insert these mobile numbers into a table by using sql procedure or sql trigger or any other method or coding. Is it is possible or not? If so then anybody can help me!
We have sql server 2000 and i need to read one perticular xml and from that i want ID field stored in one table...is it possible by query analyzer to read xml and stored ID in table...I have only path of that xml file...
-- drop proc SP_Trio_Popul_Stg_Tbls1 CREATE PROC [dbo].[SP_Trio_Popul_Stg_Tbls1] @tableName varchar(20) AS -- alter PROC [dbo].[SP_Trio_Popul_Stg_Tbls1] @tableName varchar(20) AS
declare @sql varchar (20)
set @sql = 'INSERT INTO dbo.Name_Pharse_Stg_Tbl1 (nm_last) SELECT nm_name FROM dbo.' + quotename(@tableName)
print @sql exec (@sql)
---------------------------------------------------------------------- exec SP_Trio_Popul_Stg_Tbls1 '00485' ---------------------------------------------------------------------- INSERT INTO dbo.Name Server: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near 'Name'.
im trying to run this SP but im getting an error. Can you help me to fix it?
Hi, I've been a developer for 20 some years, but never learned the design steps of a complex database. Can you give me a book or 2 to bring me up to speed with the latest database design and data modeling techniques?