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
  • MS-SQL - Bulk Insert query

    database question
    3
    0 Votes
    3 Posts
    0 Views
    2
    Ashfield wrote: How about defining a default value for the column? That may not work since the timestamp is same only per bulk insert. I do have a solution for this, wrap bulk insert inside a stored proc, and update the the timestamp from SP. But this would introduce few additional steps, was wondering if this can be avoided in case if BULK INSERT already has this feature. Thank you, Suhredayan
  • Sql Doubt

    database
    6
    0 Votes
    6 Posts
    0 Views
    R
    Thanks for ur timely help... Nothing is Impossible. Keep always Smiling... :)
  • Question about using conditional SQL statement

    database question help
    6
    0 Votes
    6 Posts
    0 Views
    A
    no problem Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • SQL Between Stored Proc

    database question
    3
    0 Votes
    3 Posts
    0 Views
    A
    CREATE PROCEDURE usp_GetDataFromDateRange( @Start DATETIME, @End DATETIME ) AS BEGIN SET NOCOUNT ON; SELECT * FROM MyTable WHERE DateCol BETWEEN @Start AND @End RETURN END I don't speak Idiot - please talk slowly and clearly 'This space for rent' Driven to the arms of Heineken by the wife
  • where clause in sql [modified]

    database question
    8
    0 Votes
    8 Posts
    0 Views
    N
    Take this example declare @t table(username varchar(50),userid varchar(100)) insert into @t select 'username1','a' union all select 'username1','b' union all select 'username1','c' union all select 'username1','d' union all select 'username2','a' union all select 'username3','b' union all select 'username3','c' union all select 'username3','d' union all select 'username4','a' union all select 'username4','b' union all select 'username4','c' union all select 'username5','d' union all select 'username6','a' union all select 'username7','b' union all select 'username8','c' union all select 'username8','d' username userid username1 a username1 b username1 c username1 d username2 a username3 b username3 c username3 d username4 a username4 b username4 c username5 d username6 a username7 b username8 c username8 d I want to find the users who has userid only 'a'. So in this case the desired output will be username2 and username6 Query 1: select username from @t except select username from @t where userid in('b','c','d') Query 2: select t1.username from @t t1 left join (select username from @t where userid in('b','c','d')) x on x.username = t1.username where x.username is null Query 3: select username from ( select username, stuff((select ',' + CAST(t2.userid as varchar(max)) from @t t2 where t2.username = t1.username for xml path('')),1,1,'') as userids from @t t1 group by username )X where X.userids = 'a' In all the 3 cases the output is username username2 username6 Hope this helps :) Niladri Biswas
  • 0 Votes
    2 Posts
    0 Views
    I
    There are a couple of open source projects on http://www.codeplex.com/site/search?projectSearchText=migration[^] that may be worth looking at but there is nothing from Microsoft.
  • DSn Creation through SQLConfigDataSource() funciton

    database help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Invalid Object Name : 'sysdatabases'

    database help sql-server sysadmin
    5
    0 Votes
    5 Posts
    0 Views
    R
    Have you tried prepending 'sys.' to it. eg. select * from sys.sysdatabases? Regards, Rob Philpott.
  • 0 Votes
    3 Posts
    0 Views
    S
    I too had the same problem some time back and I too tried many solutions. Here are the few good steps and a video to resolve this error. http://techpint.com/programming/error-26-%E2%80%93-error-locating-serverinstance-specified-sql-server[^]
  • How to delete data from database

    database tutorial
    8
    0 Votes
    8 Posts
    0 Views
    J
    Mycroft Holmes wrote: When he comes back with "I can't truncate the table", you can try explaining foreign keys Or Cascade. ;P
  • Deny users to change data through backend

    database csharp asp-net sql-server sysadmin
    5
    0 Votes
    5 Posts
    0 Views
    L
    Each application runs under some credentials. The ASP.NET application runs on a different user-account than the one that you use to log into your Windows machine. This is done to enhance security - the application doesn't need all those permissions that you have. The builtin ASP.NET[^] account is the one that runs the application. Alternatively, you could switch your database to use "SQL Server authentication[^]". I are Troll :suss:
  • Locking and Transaction in SQL Server

    database sql-server sysadmin help question
    2
    0 Votes
    2 Posts
    0 Views
    T
    Lots of information can be found here[^] If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]
  • remote mysql server connection problem?

    help database mysql sysadmin question
    6
    0 Votes
    6 Posts
    0 Views
    L
    Then chances are that there's a firewall. Second thing to check would be if MySQL accepts remote connections - those are disabled by default[^], for security reasons. I are Troll :suss:
  • Detecting SQL Server Activity

    sysadmin database sql-server agentic-ai
    2
    0 Votes
    2 Posts
    0 Views
    G
    I think you're on the right track - SQL server has some of its own performance counters, they might be of good use to you - this shows a list http://www.extremeexperts.com/SQL/Articles/SQLCounters.aspx[^] see [SQL Server:Databases - Transactions/sec] for instance 'g'
  • problem while import TXT file

    database help question
    3
    0 Votes
    3 Posts
    0 Views
    K
    thanks for reply damian i have done same thing as u told above but still i have to go in advanced import option and correct datatype and size for all columns. how do u import your txt files ??? or is there any option for the same ??? thanks in advnace koolprasad2003 :) Rating always..... WELCOME Be a good listener...Because Opprtunity knoughts softly...N-Joy
  • 0 Votes
    12 Posts
    0 Views
    R
    Hello again, I converted the large stored procedure into smaller ones, by placing the tree generation and traversal business logic in C# code and just using stored procedures for simple checks and updates. The entire operation, then, is enclosed in a single transaction. The good news is that the 30-minute operation was optimized to 15 minutes. The bad news is that the new c# code made the web server too busy that other users couldn't use the application (even though multi-threading is automatically done by the IIS). What I plan to do is to implement multi-threading manually for this function. Do you think it will solve my problem? Any other suggestions? Thanks again. Rafferty
  • Sqlite Database

    csharp database sqlite visual-studio algorithms
    2
    0 Votes
    2 Posts
    0 Views
    L
    savitri wrote: I am doing one application for Psion Teklogix Device in VC# 2003. That's probably not an i386-based device. Have you checked whether it is compiled against the correct architecture? savitri wrote: I am not getting any Dll's for that SQLite. Here's a sweet alternative; you can download http://code.google.com/p/csharp-sqlite/[^] code, and include them directly in your project :) I are Troll :suss:
  • How to send an auto mail

    database csharp asp-net sql-server sysadmin
    10
    0 Votes
    10 Posts
    0 Views
    L
    Krishhhhhhhhhhhhhh wrote: I want send an automatic mail to those status is incomplete(In my database table one column has data like either "complete" or "incomplete"). When the status is "incomplete",then send a mail daily once to "so and so email id". There are multiple ways that you can solve this. May I suggest writing a console-application that makes a SqlConnection to verify the status? It would be quite trivial to send an email from C#, and you can launch the application using Windows' task-scheduler. Krishhhhhhhhhhhhhh wrote: Stop this bloody replies and do ur job perfectly. otherwise close ur forums We're not being paid to answer you, and these forums are not a "company" that exists to serve others. This is a meeting-space where all kinds of people can trade idea's. Consider it a public market :) I are Troll :suss:
  • 0 Votes
    2 Posts
    0 Views
    B
    Create a sql job[^]