Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





C# Application - Method To Import Delimeted CSV To Sql Server Table


Hi,

I'm writing a telecom billing system where it is necessary to import csv delimited files into a sql server table.

1) The csv files to import differ in column arrangement i.e SQL server table arrangement = A, B, C, D whilst CDR = - , A, -, C, D

2) The csv files are delimited via different characters i.e some are del.. by commas some by semi colons

 I can import a CSV file from my application using a BULK INSERT query but only using CSV that resembles the structure of the table exactly

How can I pass a CSV to the table and state where I want each CSV column to fill a column in the SQL SERVER table

Below is how I am managing to pass a CDR to the SQL table that I have pre manufactured to resemble the structure of the SQL table Is there a way I can state which values from the CSV I want to pass to corresponding columns in the SQL table:

 

string conString = @"Provider=SQLOLEDB;Server=(local);Database=Billing;Uid=sa;Pwd=sa;";

for (int i = listBox1.Items.Count - 1; i >= 0; i--)

{

string strSQL;

OleDbConnection objConnection = null;

OleDbCommand objCmd = null;

objConnection = new OleDbConnection(conString);

 

string cdr = listBox1.GetItemText(listBox1.Items[i]);

 

strSQL = "BULK INSERT Campaign FROM '"+ cdr +"' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '
')";

OleDbDataReader objDataReader;

 

try

{

objConnection.Open();

objCmd = new OleDbCommand(strSQL, objConnection);

objCmd.ExecuteNonQuery();

objCmd = null;

objDataReader = null;

objConnection.Close();

listBox1.Items.Remove(listBox1.Items[i]);

}

catch (Exception ex)

{

objConnection.Close();

}

objCmd = null;

objConnection = null;

}

 

Regards

 Simon




View Complete Forum Thread with Replies

Related Forum Messages:
SSIS Import From Comma Delimeted Flat File
I have a data record as below from teh comma delimeted text file.

660,"CAMPO DE GOLF ""LA FINC ALOGORFA,",7941

SQL 2000 DTS loads this data fine whree the second column is loaded as

ABC ""DAT DESC,",



But Unable to load the record using SQL 2005 SSIS.It considers "CAMPO DE GOLF ""LA FINC ALOGORFA as one column and " as column 2. Is there any options to load this type of data using SSIS.

Thanks

View Replies !
SQL Server Import And Export Wizard Fails To Import Data From A View To A Table
A view named "Viw_Labour_Cost_By_Service_Order_No" has been created and can be run successfully on the server.
I want to import the data which draws from the view to a table using SQL Server Import and Export Wizard.
However, when I run the wizard on the server, it gives me the following error message and stop on the step Setting Source Connection
 

Operation stopped...

- Initializing Data Flow Task (Success)

- Initializing Connections (Success)

- Setting SQL Command (Success)
- Setting Source Connection (Error)
Messages
Error 0xc020801c: Source - Viw_Labour_Cost_By_Service_Order_No [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0014019.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
 (SQL Server Import and Export Wizard)
 
Exception from HRESULT: 0xC020801C (Microsoft.SqlServer.DTSPipelineWrap)
 

- Setting Destination Connection (Stopped)

- Validating (Stopped)

- Prepare for Execute (Stopped)

- Pre-execute (Stopped)

- Executing (Stopped)

- Copying to [NAV_CSG].[dbo].[Report_Labour_Cost_By_Service_Order_No] (Stopped)

- Post-execute (Stopped)
 
Does anyone encounter this problem before and know what is happening?
 
Thanks for kindly reply.
 
Best regards,
Calvin Lam 

View Replies !
How To Split A Delimeted String...
 hi,
i have a simple question, i have a sql server table named "Restaurant" and a field "Cuisines",
the values in the field Cuisines contains delimeted string. (e.g. "C1,C2,C3...C10" ,maximum to 10 items or less)
now, i want to split the values from Cuisines ("C1,C2,C3...C10") and passed all of them to a SP parameter.
e.g
@item0 nvarchar = "C1",@item1 nvarchar = "C2",@item2 nvarchar = "C3",@item3 nvarchar = "C4",@item4 nvarchar = "C5",@item5 nvarchar = "C6",@item6 nvarchar = "C7",@item7 nvarchar = "C8",@item8 nvarchar = "C9",@item9 nvarchar = "C10"
 if the field "Cuisines" contains less than 10 items, the value of the remaining parameters is null.
any response will be appreciated. thanks.
 
 

View Replies !
Method To Insert All Record From Access Table To SQL Server One
Anyone know if there is method that can insert all record from a tablein an MS Access 2000 database to a table in MS SQL Server 2000database by a SQL statement? (Therefore, I can execute the statementin my program)--Posted via http://dbforums.com

View Replies !
How Can I Import Records From A Sql Server Table In Project1 To Another Sql Server Table In Project2
Hi, i have a table with all employee bio-data in a completed project. Iam now working on another project with a table that needs the same data and here iam talking about 300 records that rarely change. Instead of re-entering this data in this new table, i want to import the data from the completed project into a table in this new project. Does any one have any idea how to achieve that or is there a better option to do the same.
One more thing iam realising here is that iam going to use this same data in very many applications and some one from one department is going to enter this data in all these different applications. so i was wondering if there could be a way of having a central database that this guy can mantain and then i be able to use that table data in different applications that iam going to develop. I dont want to kill this unlucky guy with data entry tasks every time i deploy a new application.
So basically, how can make one database application sever several different applications with its data.

View Replies !
Large Table-Table Partition, View Or Other Method?
Hi everyone,

I use sql 2005. What is the best practice for dealing with large table (more than million rows)? Table Partition, View or other?

Can you please give some suggestions? It will be very helpful if you can post some references or examples.

Thank you!

View Replies !
Where To Order The Table Values Displayed In A Web Form Object? In Sql Server Or In The Application?
Hi,

I have a table in my database with several car types, and the order I want for that table is:

Car_typeA_1
Car_typeA_2
Car_typeA_3
Car_typeA_4
Other_Cars_typeA
Car_typeB_1
Car_typeB_2
Car_typeB_3
Other_Cars_typeB
Car_typeC_1
Car_typeC_2
Car_typeC_3
Car_typeC_4
Car_typeC_5
Other_Cars_typeC
...


This table is more or less always the same, but from time to time I want to add a new car type, for instance; Car_typeA_5, but this new type must be located under the last register, in the example under ‘Other_Cars_typeC’. So, now the order is wrong, and when I want to display these car types to a web form object, the items will appear wrong ordered.

My question is: To order the values(items) correctly, Where I have to do it? In the web page (ASP.NET) code behind, or somewhere in SQL Server (for example in the Stored Procedure that passes the value to the application)? Or maybe in the same database table..?

Thank you,
Cesar

View Replies !
Can We Use DTS To Import PDF And MP3 Into SQL Server 200 Table?
I've got a situation in whcih I have to import  PDF and MP3 files into SQL Server 2000 table.

Thanks,

YL

View Replies !
Can We Use DTS To Import PDF And MP3 Into SQL Server 2000 Table?
I've got a situation in whcih I have to import  PDF and MP3 files into SQL Server 2000 table.

Thanks,

YL

View Replies !
Text Import Finding Table To Import To Problem
Dear All,I'm trying to import a quite large text file (25mb) I had this workingfine by using the transfertext command and having a schema.ini file,however having changed the username and password for my connection toSQL server all my tables and queries come with dbo attatched, which isfine as I've now edited all the relevent code and macros.However, on the transfer text command, it doesn't recognise the table Iwant to import into, it says it can't find it.I've edited it to put dbo.tablename and I've tried importing the filethrough the menu and selecting the table from the list using the wizardand it still can't find the table to import to.Any ideas?Matthew

View Replies !
Import Outlook/ACT Etc Contacts To SQL Server Table
Guys
Does anyone know of a 3rd party module/plug-in for VS or even some
downloadable code that enables the import of Outlook/ACT and similar contact
information through an ASP.NET page into a SQL Server table with ongoing
1-click button sync.

I need to replicate something similar to the Intellisync tool used in Yahoo
Mail.

regards
Andy

View Replies !
How To Import Xml Spreadsheet Data Into Sql Server Table ?
Hi,
I am trying to import "XML Spreadsheet" data into sql server table
without using Excel Interop classes or objects because I am not having
MS Excel installed on my web server on which my application is
deployed, but I am not getting exact method how to do this. I have
searched a lot but I couldn't get any information anywhere. All the
articles or information I got was not useful to me because everybody is
using XML file as a source and not "XML Spreadsheet". Can anybody help
me for this problem. Please note that I am not having XML file instead
I am having "XML Spreadsheet". Please help me.

View Replies !
T-SQL: Import Excel List Into SQL Server Table
Hi everyone!

I asked a similar question like this yesterday but i didnt work the way I wanted it to work. So I will ask in a diffrent way:

I have an Excel list which i want to import into a table in my SQL Server 2005. The ServerTable has one more column (for the the primary key which is created automatically) than the ExcelList. How can i import the ExcelList in a way so that I the first column of my ServerTable is not filled by a column of my ExcelList??

That is how far I came:

select *
into SQLServerTable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D: esting.xls;HDR=YES',
'SELECT * FROM [Sheet1$]')


many thanks and greetings from austria

landau

View Replies !
Import Excel Data To A Sql Server Table
Hi,

I need to import data from more than 10 excels having the same format in to a single sql server table.

I tried to use

INSERT INTO MyTempTable
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 11.0;Database=C:Book1.xls', [Sheet1$])

but got the below error
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server.

If DTS package is used then I am not sure how I can place 10 excels at a time so that they can be picked one by one and data is imported in to table.

Please help.

Thanks,
Vimalraj

View Replies !
Moving One Table From One Server To Another Server Using Import/export?
I have two databases on two different servers (an old hosting solution and a new). I need to get all the data from one server to the other but I have no clue as how to do it with MS SQL Server Management Studio Express.
 
I can easily make the create table scripts that will allow me to create the tables on the new server but what about all the data. I wondered if there is some way to export and import data from one server to another?
 
With the old SQL Enterprise Manager I was able to import or export as I saw fit but I can't seem to find anything like this with the express manager.
 
Anyone has any advise as I would like to avoid coding somekind of export program myself,
 
 
Many kind regards
 
Weinreich
 

View Replies !
Import Text File To Sql Table In Sql Server 2005
hi guys
i need  to import text file to sql table in sql server 2005 ...using query how do i import text file to sql table .......................
 i need query
i dont want go Import/export options

View Replies !
Import A Particular Column From Excel Into An Exsisting SQL Server 7.0 Table
Hi

I am trying to import a particular column from Excel file

to an exsisting SQL Server7.0 table .

i.e firstname column from excel file e.g test1.xls
should overwrite the firstname field in SQL Server table e.g SQL_test1

Please help me.

Thanks
Ashish

View Replies !
VB Code To Export And Import SQL Server Table To Oracle
Hi,

Please do anyone know a VB 2005 code to export and import SQL server table to Oracle. Thanks.

View Replies !
Send Request To Stored Procedure From A Method And Receive The Resposne Back To The Method
Hi,I am trying to write a method which needs to call a stored procedure and then needs to get the response of the stored procedure back to the variable i declared in the method. private string GetFromCode(string strWebVersionFromCode, string strWebVersionString)    {      //call stored procedure  } strWebVersionFromCode = GetFromCode(strFromCode, "web_version"); // is the var which will store the response.how should I do this?Please assist.  

View Replies !
[Table Partitioning] What Is The Best Method?
Hello,

I have a Sql Server 2005 database with many tables, each with millions of records within them.

They all have a Receive Date field, with records going back 10 years or so.

What would be the best way to partition it? I was thinking of partitioning them by years, but that would give me 10+ partitions -- would that be alot of overhead?

~Le

View Replies !
Table FillSchema Method
Hi,
 
Sorry if these is not the right forum for this:
 
I€™m using the data adapter method FillSchema works fine in MS Access but SQL Server Express Edition it doesn€™t get the primary key of the table. For example if I try to use the Find method of the dataset I get this error €œTable doesn't have a primary key€? but in MS Access these do not happen.
 
This is the code that I€™m using:
Dim sql As String = "SELECT admin.rents.id, admin.rents.transaction_id, admin.rents.item_id, admin.rents.description, admin.rents.due_date, admin.rents.return_date, "
sql &= "admin.rents.amount_to_pay, admin.rents.paid_amount, admin.rents.tax, admin.rents.type, admin.rents.deposit_id "
sql &= "FROM admin.rents INNER JOIN "
sql &= "admin.transactions ON admin.rents.transaction_id = admin.transactions.id "
sql &= "WHERE admin.transactions.customer_id=?; "
 
RentsDA = New OdbcDataAdapter(sql, cn)
With RentsDA.SelectCommand
    .Parameters.Add(New OdbcParameter("@customer_id", OdbcType.Int)).Value = TextBox1.Text.Trim
End With
RentsDA.FillSchema(ds, SchemaType.Source, "Rents")
RentsDA.Fill(ds, "Rents")
 
It's because of the joins?
I need to configure something in the sql server?
What is the problem?

View Replies !
Sql Server 2005 Express: Export/Import Content Of A Table
 I want to export data in a table from one database to another database. And I would like it bo be clone of the source table, if it's possible. Is there any tools out there that can help me with this or do I have to write my own code?Is it possible to query the database to get all columns and datatypes for Ã¥ requested table? If possible, can you give me an example?If I have to write a tool myself I guess I would do something like this: Export - Query the database for columns and datatype for the requested table. Dynamically generate a query to retrieve all rows from the table and save it to an xml file. Import - Turn off the Identity Increment, loop through the xml file and generate insert queries to insert a clone of each row, turn off the Identity Increment. Viola! If programming only could be that simple :-) Regards, Sigurd 

View Replies !
DTS Import Problem With Text Datatype From SQL Server To MySQL Table
Can anybody tell how to import a table with the text column from SQL Server 2000 to MySQL 4.0.17?
I tried this using ODBC connection but got an error message saying, "Query-based Insertion or updating of BLOB values is not supported".

View Replies !
Adding TableAdapter Table Method
Hello,
I was wondering if there was any way to add a method to a custom datatable that is setup in a tableadapter?  In the dataset, the tableadapter has a definition, and the corresponding table method has a FindBy<PK>() method that finds an entry by the PK.  I was wondering if it is possible to create a method like that because I have a unique field and I want to determine if such value exists.
Thanks.

View Replies !
Quickest Method Of Updating A Table
I have a DataSet which I am holding in .NET and I would like to know the quickest way to get the DataSet in to a Table on SQL Server?
Any sample code would be great.

View Replies !
Using Row_Number Method With Temporary Table
Hi.

I have been wrestling with designing a stored procedure
for a bit (some of you may recognize the below code). I
am now trying to add paging and need some help. I am
trying to use the ROW_NUMBER() method as provided in
SQL 2005. The below code demonstrates its use (not my
code) :


Code:


DECLARE @PageNum AS INT;
DECLARE @PageSize AS INT;

SET @PageNum = 2;
SET @PageSize = 10;

WITH OrdersRN AS
(
SELECT ROW_NUMBER() OVER(ORDER BY OrderDate, OrderID) AS RowNum
,OrderID
,OrderDate
,CustomerID
,EmployeeID
FROM dbo.Orders
)

SELECT *
FROM OrdersRN
WHERE RowNum BETWEEN (@PageNum - 1) * @PageSize + 1
AND @PageNum * @PageSize
ORDER BY OrderDate
,OrderID;



Now, what I would like to do is apply my own code to the above
example. In the above example, the table "Orders" is used to
return data and provide a page count. In my own code, I create
a temporary table using multiple joins. Below is the core of it:


Code:



SELECT COALESCE
(
tab1.emailAddress,
tab2.user_name,
tab3.email_address,
tab4.email_address
)
id ,
tab1.bday_day ,
tab1.bday_month ,
tab1.bday_year ,
tab1.gender ,
tab1.zipCode ,
tab1.siteId ,
tab1.userID ,
tab2.photo_location ,
tab2.photo_name ,
tab2.photo_default ,
tab2.no_photo ,
tab3.headline ,
tab3.about_me ,
tab4.login_date ,
tab4.login_isonline

FROM

(select distinct emailAddress
from Users with(nolock) union select distinct user_name
from PersonalPhotos with(nolock) union select distinct email_address
from EditProfile with(nolock) union select distinct email_address
from SavedSearches with(nolock) union select distinct email_address
from UserPrecedence with(nolock) union select distinct email_address
from LastLogin with(nolock)) drv
Left Join Users tab1 on (drv.emailAddress = tab1.emailAddress)
Inner Join UserPrecedence tab5 on tab5.UserID=tab1.UserID
Left Join PersonalPhotos tab2 on (drv.emailAddress = tab2.user_name)
Left Join LastLogin tab4 on (drv.emailAddress = tab4.email_address)
Left Join EditProfile tab3 on (drv.emailAddress = tab3.email_address)
Left Join SavedSearches tab6 on (drv.emailAddress = tab6.email_address)

WHERE

tab1.gender = @gender
AND tab1.country = @country
AND tab1.bday_year BETWEEN @low AND @high
AND tab2.photo_default = 1 + @photo

ORDER BY CASE @sort

WHEN 1 THEN tab1.registerDate
WHEN 2 THEN tab3.edit_date
WHEN 3 THEN tab4.login_date
WHEN 4 THEN tab5.up_order

END DESC



So, where I need help is - how do I substitute my temporary table shown directly above for the table "Orders" in the example code?

Thanks for your help.

View Replies !
How To Use Inner Join In Update Method For 1 Table
i need to use inner join while updating..
im using only one table..


rajesh

View Replies !
Passing Table Name To The Openxml Method
I want to pass the table name as a variable

Declare @tbl varchar(30)
set @tbl = 'DB.dbo.Set'
declare @sql nvarchar(200)
set @sql =
'select * from OPENXML(@xmldoc,'DB.dbo.Site',2) with' + @tbl + ''
exec(@sql)

Please help me with the correct syntax.
Mayank

View Replies !
Import Excel Spreadsheet Data Into SQL Server Database Table Using SqlBulkCopy
 
Hi, I'm a Student, and since a few months ago I'm learning JAVA. I'm creating an application to call and compare times. For this I create in Excel a time table which is quite big and it would be a lot of typing work to input one by one the data in each cell in SQL Server, considering that I have to create 8 more tables. I was able to retreive the data from excel usin the JXL API of JAVA but it doesn't give all the funtions to perform math operations as JDBC. That's why I need to move the tables from Excel to SQL.
I found this site http://davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx which gives a code to do so, but I guess that some heathers are missing or maybe I don't know which compiler to use to run that code, I would like you help to identify which compiler use to run that code or if there is some vital piece of code missing.// Connection String to Excel Workbook
string excelConnectionString = @"Provider=Microsoft .Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";

// Create Connection to Excel Workbook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand ("Select ID,Data FROM [Data$]", connection);

connection.Open();

// Create DbDataReader to Data Worksheet
using (DbDataReader dr = command.ExecuteReader())
{
// SQL Server Connection String
string sqlConnectionString = "Data Source=.; Initial Catalog=Test;Integrated Security=True";

// Bulk Copy to SQL Server
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "ExcelData";
bulkCopy.WriteToServer(dr);
}
}
}
On the other hand in this forum I that someelse use that link but implements a totally different code which I'm not able to compile also http://forums.asp.net/p/1110412/2057095.aspx#2057095. It seems this code works as I was able to read, but I do not know which language is used.
Dim excelConnectionString As String = "Provider=Microsoft .Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;"""
 
' Using
 
Dim connection As OleDbConnection = New OleDbConnection(excelConnectionString)
 
Try
 
Dim command As OleDbCommand = New OleDbCommand("Select ID,Data FROM [Data$]", connection)
connection.Open()
 
' Using
 
Dim dr As DbDataReader = command.ExecuteReader
 
Try
 
Dim sqlConnectionString As String = WebConfigurationManager.ConnectionStrings("CampaignEnterpriseConnectionString").ConnectionString
 
' Using
 
Dim bulkCopy As SqlBulkCopy = New SqlBulkCopy(sqlConnectionString)
 
Try
bulkCopy.DestinationTableName =
"ExcelData"
bulkCopy.WriteToServer(dr)
 
Finally
 
CType(bulkCopy, IDisposable).Dispose()
 
End Try
 
Finally
 
CType(dr, IDisposable).Dispose()
 
End Try
 
Finally
 
CType(connection, IDisposable).Dispose()
 
End Try
 
Catch ex As Exception
 
End Try
The Compilers I have are: Eclipse, Netbeans, MS Visual C++ Express Edition and MS Visual C# Express Edition. In MS Visual C++
Thanks for your help.
 Regads,
Robert.
 

View Replies !
Seek Method, Table-direct, And Sql Server2005
From what I've read in the docs, ado.net currently supports opening sqlserver ce tables in table-direct mode and performing Seek operations on them(using SqlCeDataReader), but not on the full-blown sql server. Is this(will this be) still true with ado.net 2.0 & sql server 2005?

View Replies !
Easier Method To Remove And Add A Table To Database?
I have a table that is corrupted and want to remove and add a backup version of it. How can i remove this table and add it again preserving all the foregin key restraints, permissions, dependencies, etc? Simply exporting and importing does not work. I could painfully remove the table and then painfully reconnect it again, recreating all the foreign key restraints, etc, by hand; but there has to be an easier way! What is the How-to?

Thank you!

Llyal

View Replies !
ListChildren Method Does Not Return All Columns From Catalog Table
I am trying to use the ListChildren method to query the SSRS Catalog. I am using this as a dataset in a report. I'd like to see more columns, in particular the Description column, included in the dataset. Is there some way to tell ListChildren what columns should be included or is there some other method to obtain this information.
ListChildren returns ID, Name, Path, Type, CreationDate, ModifiedDate, CreatedBy, ModifiedBy, xmlns.
 
I'd prefer not to query the Catalog table directly.
 
Thanks
Tim

View Replies !
Update Method Is Not Finding A Nongeneric Method!!! Please Help
Hi,
 I just have a Dataset with my tables and thats it
 I have a grid view with several datas on it
no problem to get the data or insert but as soon as I try to delete or update some records the local machine through the same error
Unable to find nongeneric method...
I've try to create an Update query into my table adapters but still not working with this one
Also, try to remove the original_{0} and got the same error...
 Please help if anyone has a solution
 
Thanks

View Replies !
Error Inserting Image Into SQL Server2000 Table From Pocket PC Application Only When Using Stored Procedure In Table Adapter Wiz
My Pocket PC application exports signature as an image. Everything is fine when choose Use SQL statements in TableAdapter Configuration Wizard.
 

main.ds.MailsSignature.Clear();

main.ds.MailsSignature.AcceptChanges();
 

string[] signFiles = Directory.GetFiles(Settings.signDirectory);

 
foreach (string signFile in signFiles)

{


mailsSignatureRow = main.ds.MailsSignature.NewMailsSignatureRow();

mailsSignatureRow.Singnature = GetImageBytes(signFile); //return byte[] array of the image.

main.ds.MailsSignature.Rows.Add(mailsSignatureRow);

}
 

mailsSignatureTableAdapter.Update(main.ds.MailsSignature);
 
But now I am getting error "General Network Error. Check your network documentation" after specifying Use existing stored procedure in TableAdpater Configuration Wizard.
 

ALTER PROCEDURE dbo.Insert_MailSignature( @Singnature image )

AS

SET NOCOUNT OFF;

INSERT INTO MailsSignature (Singnature) VALUES (@Singnature);



SELECT Id, Singnature FROM MailsSignature WHERE (Id = SCOPE_IDENTITY())
 
For testing I created a desktop application and found that the same Code, same(Use existing stored procedure in TableAdpater Configuration Wizard) and same stored procedure is working fine in inserting image into the table.
 
Is there any limitation in CF?
 
Regards,
Professor Corrie.

View Replies !
Preferred Method To Incorporate Common Table Expression (CTE) Functionality
What is the best approach to utilize a recursive CTE (Common Table Expression) to filter a resultset?  The CTE function is used in all application queries to limit recursively the final resultset based on a provided hierarchical organization identifier. i.e. join from some point in the organization chart on down based on an organization id. I would prefer that the query could be run real-time. i.e. not having to persist the prediction portion of the results to a sql relational table and  then limiting the persisted results based on the CTE function. 

It appears that I can use a linked server to access the prediction queries directly from SQL Server (link below). I believe that I might also be able to deploy a CTE recursive function within a .net assembly to the Analysis Server but I doubt that recursive functionality is availalble without a linked SQL Server.
Executing prediction queries from the relational server
http://www.sqlserverdatamining.com/DMCommunity/TipsNTricks/3914.aspx
 
 

 

View Replies !
Other Method To Export Data From Flat File To SQL Table Beside Bulk Insert ?
Hi,

I'm trying to export data from flat file into SQL Server table. I tried using the bulk insert command but unfortunately i don't have the sysadmin permission. Is there any other command in t-sql that i can use to perform this task besides bcp that execute on command line? I need to automate this task on my website. Thanks in advance.

View Replies !
Convert Old ASP.NET 1.1 ADO.NET Method To SQLDATASOURCE Method
Hello, how do I convert the following code to manually fetch the data from a SQLDATASOURCE command? I need your guys help. THanks.*****ADO.NET 1.1 CODE****Dim strconn As StringDim id As Integerdim artist as stringid = Request.QueryString("eventid")strconn = ConfigurationManager.AppSettings("EventConnection")Dim CommandText As String = "select [generaltype],  from [events] where eventid = " & idDim myConnection As New SqlConnection(strconn)Dim objDR As SqlDataReaderDim myCommand As New SqlCommand(CommandText, myConnection)myConnection.Open()objDR = myCommand.ExecuteReader()objDR.Read()If Not TypeOf objDR("artist1") Is DBNull Thenartist1 = objDR("artist1")End IfobjDR.Close()Page.DataBind()myConnection.Close()******SQLDATASOURCE 2.0 CODE****Dim sqld1 as new sqldatasourcedim artist as stringsqldatasource.connectionstrig = "xxx"sqldatasource.datasourcemode = "datareader"......etc. etc.artist1 = objdr("artist1")...***

View Replies !
Import Data From MS Access Databases To SQL Server 2000 Using The DTS Import/Export
I am attempting to import data from Microsoft Access databases to SQL Server 2000 using the DTS Import/Export Wizard. I have a few errors.

Error at Destination for Row number 1. Errors encountered so far in this task: 1.
Insert error column 152 ('ViewMentalTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 150 ('VRptTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 147 ('ViewAppTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 144 ('VPreTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 15 ('Time', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.

Could you please look into this and guide me
Thanks in advance
venkatesh
imtesh@gmail.com

View Replies !
Error Trying To Import MS Access 2003 Database Via SQL Server Import And Export Wizard - Too Many Sessions Already Active
I am trying to simplify a query given to me by one of my collegues written using the query designer of Access.  Looking at the query there seem to be some syntax differences, so to see if this was the case I thought I would import the database to my SQL Server Developer edition.

I tried to start the wizard from within SQL Server Management Studio Express as shown in one of the articles on MSDN which did not work, but the manual method also suggested did work.

Trouble is that it gets most of the way through the import until it spews forth the following error messages:

- Prepare for Execute (Error)
Messages
Error 0xc0202009: {332B4EB1-AF51-4FFF-A3C9-3AEE594FCB11}: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available.  Source: "Microsoft JET Database Engine"  Hresult: 0x80004005  Description: "Could not start session.  Too many sessions already active.".
 (SQL Server Import and Export Wizard)
 
Error 0xc020801c: Data Flow Task: The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.
 (SQL Server Import and Export Wizard)
 
Error 0xc004701a: Data Flow Task: component "Source 33 - ATable" (2065) failed the pre-execute phase and returned error code 0xC020801C.
 (SQL Server Import and Export Wizard).

There does not seem to be any method of specifying a number of sessions, so I don't see how to get round the problem.

Does anyone know how I can get the import to work?

View Replies !
The Push Method Returned One Or More Error Rows. See The Specified Error Table. [ Error Table Name = ]
Hi,
I have application in which i am performing synchronization between SQL Server 2000 and SQL Server 2005 CE.
I have one table "ItemMaster" in my database.There is no relationship with this table,it is standalone.I am updating its values from Windows Mobile Device.

I am performing below operations for that.
Step : 1 Pull To Mobile



Code BlockmoSqlCeRemoteDataAccess.Pull("ItemMaster", "SELECT * FROM ItemMaster", lsConnectString,RdaTrackOption.TrackingOn);
 
 



Step : 2 Using one device form i am updating table "ItemMaster" table's values.
 
Step : 3 Push From Mobile



Code BlockmoSqlCeRemoteDataAccess.Push("ItemMaster", msConnectString);
 
 


So i am getting an error on 3rd step.
While i am trying to push it says, 
"The Push method returned one or more error rows. See the specified error table. [ Error table name = ]".
I have tried it in different ways but still i am getting this error.
 
Note : Synchronization is working fine.There is not issue with my IIS,SQL CE & SQL Server 2k.
 
Can any one help me?I am trying for that since last 3 days.

View Replies !
SQL Server 2000 Migration To SQL Server 2005 Collation Change - Method?
Scenario
Recently moved a SQL2000 database to SQL2005.
Collation on SQL 2000 database server was SQL_Latin1_General_CP1_CI_AS
Colaltion on SQL 2005 database server is Latin1_General_CI_AS

After restoring the SQL 2000 database on SQL 2005 we observed that the database collation was SQL_Latin1_General_CP1_CI_AS. We have altered the database collation to Latin1_General_CI_AS. We understand this will work for all new objects created on the database but existing objects (prior to the collation change) will continue to have the 'SQL_Latin1_General_CP1_CI_AS' collation.
 
What is the best method to change the collation of the older columns to 'Latin1_General_CI_AS' -
1) Run ALTER TABLE ALTER COLUMN <colname> <datatype> COLLATE Latin1_General_CI_AS <nullability>
on each varchar/char column
 
or
 
2) For each table
BCP out data
DROP TABLE
RECREATE TABLE (taking the new collation Latin1_General_CI_AS)
BCP in data
 
3) Other methods?
 
Thanks in advance
David.

View Replies !
Create Table From Web Application
i am creating a model in which the control panel i am building for a web application, i can write sql statements in a textbox and the query will be done in my application. But i am have a problem creating a table.
this error of "Create table permission not granted in the sql server" pops up whenever i want to execute the create table sql statements from my web page.
How can i permit my sql server to allow creation of tables from my web application.
Thanks

View Replies !
Best Method To Upgrade From SQL Server 2000 To SQL Server 2005
Hi.

We are going to upgrade one of our SQL Server 2000/Win200 instance to SQL Server 2005/Win2003. Currently, the SQL Server 2000 which contains about 30 database. This is my plan:


Install SQL Server 2005/Win2003 on a new instance
Backup SQL Server 2000 database instance (how do I back all 30 database at the same time?)

Then do a Restore from the SQL Server 2005 instanceIs this a good method or using the "Copy Database Wizard" is better method?

I'm new to this so please advice? Thanks!

View Replies !
Web.config Method To Sql Server Both Dev And Prod
any suggestions on having one web config that once put on the dev servers uses the dev sql server and when put on prod will use the production sql server?
 would like to encrypt it and be done with it. but it needs to recognize the server it's on.
I have a connection class that does this - but i need to use sqldatasource and not objectdatasource.
 

View Replies !
Can Server.URLEncode Method Used On Sql 2005?
we have a search string is used Server.URLEncode Method in sql 2000, but since we moved database from server2000 to 2005 then ,this search string doesn't work. does some know it?????

 
the code is :
 
Public Function categories(strType, recID)
   Dim objConn, objRS
   Set objConn = Server.CreateObject("ADODB.Connection")
   objConn.Open strRGConnection
   Set objRS = Server.CreateObject("ADODB.Recordset")
   Set objRS.ActiveConnection = objConn
   If strType = "product" Then
      strQ = "SELECT category FROM productsCategories where prodID = " & CInt(prodID)
   End If
   If strType = "service" Then
      strQ = "SELECT category FROM ServicesCategories where svcID = " & CInt(svcID)
   End If
   objRs.Open strQ
   categories = ""
   tempCategories = ""
   firstRec = True
   While not objRS.EOF
     If NOT firstRec Then
        tempCategories = tempCategories & ", "
     End If
 
  tempCategories = tempCategories & "<a href='/resourceguide/resources/searchResults.asp?category=" & server.URLEncode(replace(objRS("category"),"'", "''")) & "&searchSource=Browse'>" & objRS("category") & "</a>"
     firstRec = False
     objRS.MoveNext
   Wend
   categories = tempCategories
   objRS.Close
   objConn.Close
   Set objRS = Nothing
   Set objConn = Nothing
End Function

View Replies !
Windows Application - How Can I Save The Values In Table?
HelloI use vs2008 and i try to make a simple windows program with add records to a database. The problem is the database don't store the values that i add. When i run my program (in design mode) everythynf looks fine, but if i close vs2008 and restart it again the database is empty.
Why?
Thank you

View Replies !
Delete Method From SQL Server Management Studio
 I have the following code and 3 table columns on my table. All I want to do is when the description inputed into textbox1 is equal to the description on the table delete the row. I cant figuere out for the life of me what is wrong with my statement can anyone please point out the obvious for this young. .net noob. It looks like it should work.
Thanks in advance.
 
 
 Protected Sub DEL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DEL.Click
Dim myConnection As SqlConnectionDim myCommand As SqlCommand
'Dim ra As IntegermyConnection = New SqlConnection("server=****.cis.temple.edu;Database=****;User id=****;Password=*****")
myConnection.Open()myCommand = New SqlCommand("Delete From Product Where 'Description' = '" & TextBox1.Text.Trim & "', )", myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()

View Replies !
Best Method Of Checking For Duplicate Entries In SQL Server
Here is my situation.  I have a table in my application that pairs users with cars they like.  We'll call this table Favorites.  A user can browse the site and they can designate as many cars they want as favorites.  For example, a user can go to the Honda Accord page and add that as a favorite car and then go to the Toyota Camry page and add that as a favorite car.  However, if he/she goes to that Honda Accord page and tries to click the "Add to Favorites" button again, at the present state of my application, it will just add another entry into the Favorites table with a duplicate pairing.  So, if I were to datalist the table to generate a listing of all favorites belonging to a certain user, he/she may potentially be returned with superfluous duplicate entries.  Not to mention, taking up valuable database space and not looking very professional.
In my Favorites table, the 3 fields are.....favoriteId (set as primary key)userIdcarId
I've been thinking about this for awhile and I've come up with 2 solutions.  I'm a newbie to ASP.NET/programming so I don't have enough insight to make a decision or to even think up of other alternatives.
1) Check proactively by doing a.....SELECT favoriteID FROM Favorites WHERE userId = x and carId = y  (where x and y are variables)If I get a null return, it means I can go ahead and let the user add the car as a favorite in the database.  If I get a valid value, then it means there already exists the same pairing, so I exit out without updating the table.
2) Check reactively by forcing an exception whenever a user tries to enter a duplicate pairing.  I'm not sure how to do this, but perhaps, instead of making "favoriteId" a primary key, perhaps, I can make a primary key pairing of "userId" and "carId".  And by trying to do an insert with a primary key that already exists, we know it won't work since primary keys by definition are unique.
Now, I expect some concurrent users on my site, so I must take into consideration pros and cons of each and determine which is more efficient.  Checking proactively will force a check even if the table does not contain a duplicate pairing of user and car.  However, having a duplicate primary key may be more expensive from a database point of view and may slow down lookups, etc.  Or maybe neither has significant benefits, in which case, I rather go with proactive, since I've already coded it and it works fine.  Or maybe there is a third alternative, which I did not think.  Which method do programmers usually take and which is a better practice?
TIA for your help.

View Replies !
Does Microsoft SQL Server Support Any Partitioning Method?
I was wondering if Microsoft SQL Server support any partitioning method (like range, list, hash or composite partitioning in Oracle) or you have to partition all tables manually?

Thanks in advance,

Bracia

View Replies !
Is There A Method To Convert &"Select * From Table&" To &"Select Field1,field2,...fieldn From Table&" ?
Is there a method to convert "Select * From Table" to "Select field1,field2,...fieldn From Table" ?
 
Thanks

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved