|
Hi to all,
please help me i am finding commands to Backup and restore sql database which i will select , from my .Net project directly.
anant
-- modified at 3:03 Sunday 19th March, 2006
|
|
|
|
|
Hi, the only SQL Command I know is this one:
The SELECT INTO Statement
The SELECT INTO statement is most often used to create backup copies of tables or for archiving records.
Syntax
SELECT column_name(s) INTO newtable [IN externaldatabase]
FROM source
Check the w3school website for complete documentation:
http://www.w3schools.com/sql/sql_select_into.asp
With Kind Regards
|
|
|
|
|
backup database database_name to disk='path'
Beemen Beshara
-- modified at 10:50 Sunday 19th March, 2006
|
|
|
|
|
hi Beemen,
Thanks for helping me, But you didn't give the restore command.
I tried the Backup command and it worked, COOL man .
My the faculties never teach me these kinds commands.
THANKs
anant
|
|
|
|
|
Hi Amit,
You should you DataSet for First,Back,Next,Last.
How to use?
1. Use DataAdapter to Fill DataSet and then it will be easy. But make a Separate Function like RecordJumper(Num as internet) as Integer.
where num is to Move record Up/Down.
2. Like wise for Last ---------- RecordJumper(0),
for back ---------- RecordJumper(i-1)
for next ---------- RecordJumper(i+1)
for last ---------- RecordJumper(record.RecordCount -1)
And use DataAdapter with DataSet to Add,Remove,Modify,Update.
Note: Use select commands for Add,Remove,Modify,Update.
I think this will help you.
anant
|
|
|
|
|
Hi,
Is there a command to only get row 450-500 out of a 1000 row result?
nixter
|
|
|
|
|
i think there is no direct way for that. But you can use subtract query. And if you get any direct way then also tell me.
|
|
|
|
|
Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax:
<br />
LOAD DATA LOCAL INFILE 'filename.csv'<br />
INTO TABLE myTable<br />
FIELDS TERMINATED BY ','<br />
LINES TERMINATED BY '\n';<br />
But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands?
If not, what is the recommended method for importing files?
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
There are several interfaces to enter SQL commands for SQL Server: Query Analyzer (a GUI application), isql.exe and osql.exe , plus sqlcmd.exe in SQL Server 2005.
For performing a bulk file import, you would normally use either bcp.exe (stands for Bulk CoPy) or the BULK INSERT statement.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
You need the MS SQL server enterprise manager there you will find a tool just to import and export data for just about anything.
Hear,See,Learn,Understand,Practice <hslup>
Many can be good,but only ONE can be the best keep practicing
|
|
|
|
|
Thanks guys, I used Enterprise Manager and it was pretty simple for importing 37K rows of CSV data. Getting data into your database is easy BUT... when I create a Table Definition importing to that seems to need some extra work. I get the impression I'll have to write a Stored Procedure in TSQL to convert the data into the desired custom Table Format. Recommendations welcome.
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
I want to display a simple Crystal Report (already, I think this is an oxymoron) in a Windows Form using a dataset (I'd prefer to do all the database work in my code, rather than letting CR do it).
All of my C# code is using Oracle.DataAccess.Client, but when I tried to create a new DataSet, VS said I had to use the Microsoft Oracle object. I did, created a DataSet with one table, EMPLOYEE. I then created my report that lists four items from the table -- no grouping, no counting, just a list.
Then, I created a Windows Form that gathers the required parameters for my query, and using those parameters, build the SQL. I use the SQL to fill the EMPLOYEE table in the DataSet created earlier. If I look, the table has 700+ rows after filling.
Then, I create a report object, set the datasource to the filled dataset, and set the Crystal Reports Viewer's ReportSource to the report. Seems straightforward, no errors. However, when I try to display the new form (that contains the crystalReportViewer), I am presented with a logon dialog box, asking for server, database, username, password. Even if I supply all of these items, it fails to logon. The form containing the viewer is shown, but there is no report.
I tried filling the dataset with the MS Oracle connection/command/dataadapter, but it made no difference. I also tried setting the username/password for each table in the report after the report object was created, but no luck either.
I read http://support.businessobjects.com/forums/message.asp?fid=251&sk=5&ps=25&pn=1&mid=152400#m152400, and a couple of other articles as well (http://www.codeproject.com/aspnet/crystal_report.asp#xx852522xx, http://aspalliance.com/265, and http://www.dotnetjunkies.com/Article/790775A0-C493-46D8-ABE0-40CA588D33D3.dcik).
Any thoughts on how to make this work, and/or a better place to ask?
DatasetReportPositiveEmployees ds = new DatasetReportPositiveEmployees();
string sSQL = "SELECT DISTINCT empID, empFName, empLName, empAcctNum from Employee " +
"LEFT INNER JOIN TestResult ON empID = testEmployeeID " +
"WHERE (testResult IN (SELECT resultID FROM Result WHERE resultTreatAsPositive=1))";
System.Data.OracleClient.OracleConnection localConn = new System.Data.OracleClient.OracleConnection(settings.ConnectionString);
localConn.Open();
System.Data.OracleClient.OracleCommand localCmd = new System.Data.OracleClient.OracleCommand();
localCmd.Connection = localConn;
localCmd.CommandText = sSQL;
localCmd.CommandType = CommandType.Text;
System.Data.OracleClient.OracleDataAdapter adapter = new System.Data.OracleClient.OracleDataAdapter();
adapter.SelectCommand = localCmd;
adapter.Fill(ds, "EMPLOYEE");
CrystalReportPositiveEmployees report = new CrystalReportPositiveEmployees();
Tried with/without this section
CrystalDecisions.Shared.TableLogOnInfo login = new CrystalDecisions.Shared.TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in report.Database.Tables)
{
login = tbl.LogOnInfo;
login.ConnectionInfo.ServerName = "myComputer";
login.ConnectionInfo.UserID = "myUser";
login.ConnectionInfo.Password = "myPass";
tbl.ApplyLogOnInfo(login);
}
report.SetDataSource(ds);
formReportViewer dlg = new formReportViewer();
dlg.crystalReportViewer1.ReportSource = report;
dlg.ShowDialog();
Thanks,
Glenn
|
|
|
|
|
Hi to all
I have MSSQL database with stored BMP binary image data.
I need to convert BLOB field to JPG on fly. My web server is based
on windows and probably I need ASP script to do that. I am new in ASP and ADO. Can anybody navigate me or recommend the source?
Thanks for all ideas.
|
|
|
|
|
There is a new version of Programming Microsoft ADO.NET 2.0 Core Reference" by David Sceppa coming out in July 2006 that looks like it will be a smart book to buy.
In the mean-time, what is the best one-stop shopping/comprehensive online source for ADO.NET 2.0 information?
|
|
|
|
|
ADO.NET[^] on MSDN.
Google[^] results
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
I want to access a .csv file on a network drive.
I am using the following code:
string filename = "csvsample.csv";<br />
<br />
string cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Y:/csv/;Extended Properties='text;HDR=Yes;FMT=Delimited'";<br />
<br />
OleDbConnection objOleDBConn = new OleDbConnection(cs);<br />
objOleDBConn.Open();<br />
sqlSelect = "select * from ["+ filename+"]"; <br />
OleDbDataAdapter objOleDBDa = new OleDbDataAdapter(sqlSelect,objOleDBConn);
However, I am getting "'Y:/csv/' is not a valid path. " error.
Y is a network drive AND the file does exist on Y:/csv/ folder.
Can anyone help me, please.
Thanks
|
|
|
|
|
Maybe it should be Y:\csv\ not Y:/csv/
Jonathan
|
|
|
|
|
I believe I will not be able to use "\" in my strings
I get compilation errors if I use:
string cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Y:\csv\;Extended Properties='text;HDR=Yes;FMT=Delimited'";
regards
|
|
|
|
|
The slash character is used as part of an escape sequence. e.g. \n
So.... Either escape the slashes
string filename= "C:\\MyFile.txt"; or put an @ symbol in front of the quote (which indicates you don't want any characters escaped)
string filename = @"C:\MyFile.txt"
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Hi Guys,
I'm thinking about using SQL2005 for storing various documents, images and binary files. Therefore, the database size will grow quite large.
There won't be many rows in the database tables. And let's assume I design my database well The large database size is only due to the binary files.
Does anyone know if there will be an impact on performance as the database size grows very large (to, say, 10s of gigabytes).
Thanks in advance!
Visit Riverside Internet[^]
Visit Mike Puddephat Online[^]
|
|
|
|
|
Mike Puddephat wrote: How Large Can SQL Server 2005 Database Be?
The maximum size is just over 1 billion terrabytes - Is that large enough? (ref: Enterprise Edition)
Mike Puddephat wrote: Does anyone know if there will be an impact on performance as the database size grows very large (to, say, 10s of gigabytes).
I don't see a great problem with that. The largest database I use on a day-to-day basis is 150Gb (growing at around 50Gb per year)
The only issue is that the hardware that supports it has to be capable as well. As you won't have many rows, just lots of binary data then I guess it won't need to do much processing, just need lots of fast disks.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
|
My workplace has Microsoft Windows Small Business Edition Premium Edition (includes Microsoft SQL Server 2000).
At home, on a Windows XP Pro with SP2 machine, I code my software with Microsoft Visual Studio 2005, Microsoft SQL Server 2005 (client-end cause Enterprise Manager is not supported on Windows XP Pro) and Microsoft SQL Server Express Edition.
Right now, all my ASP.NET pages links to a database DataSource=.\SQLExpress.
I am wondering if I were to testrun this small software I'm coding in my office's Windows SBS Server (with SQL 2000), will it run since it's coded in SQLExpress?
-- modified at 5:10 Friday 17th March, 2006
|
|
|
|
|
tanpanjang wrote: I am wondering if I were to testrun this small software I'm coding in my office's Windows SBS Server (with SQL 2000), will it run since it's coded in SQLExpress?
It depends if you are using any of the new features. If you stick to things that are available in SQL Server 2000 it will probably work on both.
However, since your business is using SBS then it will be the only server, if I remember correctly, because SBS won't allow other servers to exist on the network (part of the licencing terms - that's why it is so cheap). The conclucsion of that statement is that your business is running of the SBS and to test code on a production/live server is generally not a good idea. For a small business the interuption to service if anything went wrong may be devastating.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Can anyone please help me in my problem . i want to store the result of the exec (@sqlQuery) into a variable @TempColumnValue of type nvarchar(100)
Note: In my case exec (@sqlQuery) always returns a single value
example:
declare @sqlquery varchar(100)
declare @TempColumnValue nvarchar(50)
set @sqlQuery = 'select @TempColumnValue = firstname from usertable where userid=1'
exec (@sqlQuery)
but this gives error 'Must declare the scalar variable "@TempColumnValue"'.
Is there any other way to get it done
waiting ur response!
thanx
|
|
|
|