Skip to content
Code Project
CODE PROJECT For Those Who Code

Database

Discussions on database access, SQL, and ADO

This category can be followed from the open social web via the handle database@forum.codeproject.com

17.1k Topics 61.8k Posts
  • Detaching SQL Database .mdf file !

    database tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    A
    Use this : BACKUP DATABASE [DataBaseName] TO DISK = N'D:\DataBases\BackupDB.bak' WITH NOFORMAT, NOINIT, NAME = N'DataBaseBackup-Name', SKIP, NOREWIND, NOUNLOAD, STATS = 10 Create an object of SqlCommand and pass this as CommandText. Run this in master Database (I mean the connection object should point to master database) Use ExecuteNonQuery to take backup to Disk location mentioned. :rose: Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution. My Latest Articles-->** Microsoft Bing MAP using Javascript CLR objects in SQL Server 2005 Uncommon C# Keywords/xml>
  • 0 Votes
    12 Posts
    0 Views
    C
    Hi, Bugdate is the input and startweek, weeknumber are expected output. when date is 2009-01-02     weeknumber should be 53 and when date is 2012-01-01 week number should be 210. BugDate              Startweek      WeekNumber ---------------------------------------- 2008-12-13     2008-12-07     50 2008-12-14     2008-12-14     51 2008-12-21     2008-12-21     52 2008-12-23     2008-12-21     52 2008-12-30     2008-12-28     53 2009-01-02     2008-12-28     53 2009-12-20     2009-12-20     104 2009-12-28     2009-12-27     105 2010-01-01     2009-12-27     105 2011-12-31     2011-12-25     209 2012-01-01     2012-01-01     210 2012-01-02     2012-01-01     210 2012-01-09     2012-01-08     211
  • 0 Votes
    4 Posts
    0 Views
    I
    You send whole database or part of the database means only those items which are updated or changed. Best Regards, SOFTDEV If you have knowledge, let others light their candles at it
  • Need to add where rownum between 0 and 0 + 6 -1 in a query

    database help
    2
    0 Votes
    2 Posts
    1 Views
    N
    I have created a sample example. Hope this may help you. declare @tbl table(firstname varchar(50),lastname varchar(50)) insert into @tbl select 'firstname' + CONVERT(varchar(50),column_id) ,'lastname' + CONVERT(varchar(50),column_id) from sys.columns select * from @tbl select firstname,lastname from (select ROW_NUMBER() over(order by firstname) as rn,firstname,lastname from ( select distinct(firstname),lastname from @tbl t )X(firstname,lastname))Y(rn,firstname,lastname) where rn between 0 and 0 + 6 -1 As per the understanding I made after going thru ur statement, I thought that u r looking for unique records. Henceforth, in the very beginning only I have used a distinct clause. Note:- I tried to explain the concept. You need to customise and implement as per ur requirement. Let me know in case of any concern. I cannot make out why instead of using 5 directly u are using 0+6-1? :) Niladri Biswas
  • Problem with Execute query by EXEC(@string)

    database help sharepoint
    13
    0 Votes
    13 Posts
    0 Views
    N
    Take @string as varchar(max) and then try executing it Hope it helps!
  • Convert Oracle Query to MS-Access

    database oracle question
    7
    0 Votes
    7 Posts
    0 Views
    C
    a.code = b.code(+) The (+) says any a.code value will match a NULL b.code value. Meaning you get all the a.code values. Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
  • its urgent

    database help
    3
    0 Votes
    3 Posts
    0 Views
    M
    Niladri_Biswas wrote: Note- I sql server 2008, for solving this kind of problem you can take the advantage of Hierarchial Id's Can 2008 use this format as a hierarchyID, there us no delimiter for the levels, the standard HID.ToString() looks like '/G12/1/'
  • SSIS Permission Problem

    database sql-server help csharp c++
    3
    0 Votes
    3 Posts
    0 Views
    V
    yes it does. i have resolved this Problem by adding a dts config file. The Problem was that the Connection Manager was not saving the Password. so i had to make sure that is there by Explicitly adding it in the config File. Thank you for your Reply Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
  • An Extraordinarily Dumb Question

    question database help sql-server sysadmin
    7
    0 Votes
    7 Posts
    0 Views
    R
    I may try your approach; nothing Microsoft has to suggest works. "A Journey of a Thousand Rest Stops Begins with a Single Movement"
  • How to seperate records

    tutorial
    5
    0 Votes
    5 Posts
    0 Views
    L
    Can I get back to you in a couple of days on the topic? :) I are Troll :suss:
  • database

    database tutorial
    7
    0 Votes
    7 Posts
    0 Views
    L
    To quote from the site[^]; SQL Server 2005 Express for Beginners: This video series is designed specifically for SQL Server beginners-individuals who are interested in learning the basics of how to create, manage, and connect to SQL Server Express databases. There are more short tutorials available on the web, and you can always come back here if you get stuck :) I are Troll :suss:
  • MSSQL SERVER

    sysadmin question database sql-server help
    5
    0 Votes
    5 Posts
    0 Views
    R
    Persumably you have access to the media for SQL Srver (it does not automatically come with Windows Server 2003, but is a separate product). If so the installation istructions for SQL Server 2008 can be found here[^]. There are similar instructions for each version of SQL Server since SQL 7.0 elsewhere on the same web server. Just navigate to the "SQL Server" node and select the appropriate version. It is not likely that anyone will be willing to duplicate all of those instructions in a reply to your post, so your best bet is to use the provided link.
  • [Message Deleted]

    24
    0 Votes
    24 Posts
    0 Views
    R
    You sir, are a first class jackass.
  • how to add int Value

    tutorial question
    4
    0 Votes
    4 Posts
    0 Views
    M
    yamunarani wrote: explain in detail. The new snd codz plz Sorry if you cannot work it out then I can't help you. Never underestimate the power of human stupidity RAH
  • The Saga Continues

    database sql-server sysadmin windows-admin business
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • how to desinged tables?

    json tutorial question
    6
    0 Votes
    6 Posts
    0 Views
    M
    iceman8616 wrote: 2010.1.0 column's data type This is not a date! iceman8616 wrote: or enum I do not know of an enum column data type in SQL Server I would have a 2 column table Date datetime and State int or varchar
  • Time Diffrence in SQL

    question database
    6
    0 Votes
    6 Posts
    0 Views
    N
    Yae.. I didnot notice that I made that mistake. Very sorry. But thanks. :) Niladri Biswas
  • 0 Votes
    4 Posts
    0 Views
    N
    You have already asked this question in another thread on this forum 2) You have been advised this is not the correct forum for your question 3) It's clear you don't understand what you are doing. Go read a book, then come back and ask any questions in the appropriate forum. only two letters away from being an asset
  • 0 Votes
    5 Posts
    1 Views
    H
    My VS Team 2008 DVD only have SQL 2005 Express. Thus, I have to buy SQL 2008 or only need SQL 2008 Express? Thanks.
  • 0 Votes
    8 Posts
    0 Views
    A
    Also put Initialization code above the creation of Command object query = "INSERT INTO master(RegNo,Name)VALUES(@RegNo,@Name)"; con = new OleDbConnection(connectionstring); cmd = new OleDbCommand(query, con); cmd.Parameters.AddWithValue("@RegNo", txtRegNo.Text ); cmd.Parameters.AddWithValue("@Name", txtName.Text ); try { con.Open(); rows = cmd.ExecuteNonQuery(); if (rows > 0) { MessageBox.Show("records inserted successfully"); } } I think it will be working now. :rose: Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution. My Latest Articles-->** Microsoft Bing MAP using Javascript CLR objects in SQL Server 2005 Uncommon C# Keywords/xml>