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
  • Parameters problem

    csharp help question
    5
    0 Votes
    5 Posts
    1 Views
    B
    Do you find any difficulties to use Add() Function, cmd.Parameters.Add("@fromDate", SqlDbType.System.Data.SqlDbType.Date) cmd.Parameters.Item(0).Value = todayDate; Using Add() function you can avoid datatype conflicts here. Education is not a way to escape poverty — it is a way of fighting it.
  • error 40 : named pipes

    sysadmin help workspace
    2
    0 Votes
    2 Posts
    1 Views
    M
    Open surface area configurations of SQL server and allow remote connections. It seems that you haven't enabled them up till now that's why network users can't connect to your database. Share your experience with others Check my Blog...
  • MSMQ Performance Monitoring

    csharp testing beta-testing tools performance
    2
    0 Votes
    2 Posts
    1 Views
    L
    Google MSMQ Monitor--you will find lots of helpful results there. Back in the blog beatch! http://CraptasticNation.blogspot.com/[^]
  • SQL Stored procedure help

    database sharepoint json help question
    4
    0 Votes
    4 Posts
    1 Views
    C
    Actually, nevermind, I figured it out. Thanks!
  • database design help

    database design algorithms performance help
    7
    0 Votes
    7 Posts
    1 Views
    M
    thankyou
  • 0 Votes
    2 Posts
    1 Views
    D
    You may want to consider using your own locking logic with the help of "sp_getapplock". http://msdn.microsoft.com/en-us/library/ms189823.aspx[^] Be very careful when implementing a locking strategy you may bring your entire application to a screeching halt if locks are not released in a timely manner. You may want to use the sp_getapplock as a method to warn users that a particular account is being updated and not place any hard locks. You could also use this to indicate who has the "lock". Good luck.
  • How to get the next 1,000,000 records

    help tutorial question
    5
    0 Votes
    5 Posts
    1 Views
    M
    Select top 1m records order by ID Get the last ID in the first set (you do have an ID field) Select the top 1m records where ID > last ID You can also look into Row_Number in SQL Server, this will eliminate the detect requirement but is more complex in the select. I would assume you are processing the 1m records and therefore detecting the last ID would be trivial. Never underestimate the power of human stupidity RAH
  • ExecuteScalar()

    oracle question
    2
    0 Votes
    2 Posts
    1 Views
    M
    I don't use Oracle but try removing the RETURN, this should then get the result set back instead of trying to RETURN any output parameters (of which there are NONE). Never underestimate the power of human stupidity RAH
  • oracle query

    question database oracle tutorial
    5
    0 Votes
    5 Posts
    1 Views
    S
    thanks for ur reply.. its exactly bcz of the space...i gave like <>' ' it worked...
  • AUTO NUmber column in SQL server

    question database sql-server sysadmin
    2
    0 Votes
    2 Posts
    1 Views
    B
    ALTER TABLE MyCustomers ALTER COLUMN CustId IDENTITY (100,1); Education is not a way to escape poverty — it is a way of fighting it.
  • to include a select query inside an insert query

    database tutorial question
    3
    0 Votes
    3 Posts
    1 Views
    R
    If you are using stored procedure then inside the procedure... Insert into dbo.tblAddress Select @name,@housename,@post,genderid from dbo.tblGender where [some condition to get the specific gender] --@name,@housename,@post can be input paramaters to the stored procedure Alternatively, you can query the gender table to get the gender and store in a variable and then use the same to insert data in the address table. However the first approach is better...
  • 0 Votes
    6 Posts
    1 Views
    B
    You got my 5. Briliant. I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
  • Typical Requirement

    database tutorial
    3
    0 Votes
    3 Posts
    0 Views
    B
    Hi,I hope i understood you good enought. Here is TSQL solution which I hope will works for you. select * from mytable declare @zip as int set @zip = 123 declare @white as varchar(100) set @white =(select white from mytable where zip=@zip) declare @black as varchar(100) set @black =(select black from mytable where zip=@zip) declare @green as varchar(100) set @green =(select green from mytable where zip=@zip) create table #temptable (valstr varchar(100),colname varchar(100)) insert into #temptable values (@white,'white') insert into #temptable values (@black,'black') insert into #temptable values (@green,'green') declare @colname as varchar(100) set @colname=( select top 1 colname from #temptable order by valstr desc ) drop table #temptable declare @selectquery as nvarchar(max) set @selectquery ='select '+@colname+' from mytable where zip='+cast(@zip as varchar(10)) exec(@selectquery) I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
  • Querying Versioned Data

    database sales question announcement
    2
    0 Votes
    2 Posts
    1 Views
    D
    We had the same situation with effective pay rates for employees. I believe the structure of the table was something like this: EmpID, Rate, EffFromDate, EffToDate The query would be something like: Select rate from ratetable where EmpId=ID and targetDate => EffFromDate and targetdate <= effTodate Example, new employee: 123,$10.00,1/1/2000,12/31/2999 Example, pay increase on May 1, 2009 123,$10.00,1/1/2000,4/30/2008 123,$12.25,5/1/2008,12/31/2999 Notice that the most recent record should always have the artificially high "EffTodate" of 12/31/2999. You could also make the oldest record equal to the employee's hire date instead of some artificial low date of 1/1/2000. Best of luck. David
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • 0 Votes
    9 Posts
    0 Views
    I
    then if the table structure is static create a script file for server1 database.., read that file from c#, then manipulate it... icanmakeiteasy
  • Temporary Table

    database question sql-server sysadmin
    6
    0 Votes
    6 Posts
    1 Views
    R
    Temporary Tables are session/connection specific. So the scope and lifetime of the temporary table is directly linked with the connection or session in which the table is created and another table with the same name cannot be created in the same session. Similar to the fact that in a database you cannot have more than one table with the same name. Usually, in most of the occassions using Table Variables instead of temporary table solves the purpose and using table variable is a better practise that using temporary table... also it solves your issue of table creation
  • Insert Query

    database data-structures help tutorial
    4
    0 Votes
    4 Posts
    1 Views
    P
    I prefer a method that will handle generating the query and parameters automatically, that isn't hard-coded to any particular table.
  • UPSERT implementation

    database sql-server sysadmin beta-testing announcement
    4
    0 Votes
    4 Posts
    0 Views
    P
    Right, I use a bunch of different databases, rarely the latest and greatest. :sigh:
  • command to find specific value in select

    database help tutorial question
    4
    0 Votes
    4 Posts
    3 Views
    A
    No problem Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP