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
  • 0 Votes
    4 Posts
    0 Views
    M
    No, not really. This was introduced to limit the number of half-open connections (typically session in the SYN_WAIT state). A number of worms were rampant at that time, and they opened oodles of connections to systems simultaneously. P2P systems typically do likewise, so this patch was developed to allow P2P to run. I doubt that this is the OP's problem. I was thinking more in the line of this[^], but MS seems to imply that they don't enforce the inbound connection limit, except for SMB operations. So if the SQL server is connecting though named pipes, yes it would be a problem, but normal TCP connections should be okay.
  • 0 Votes
    4 Posts
    0 Views
    B
    In the Employees table of Northwind database, I changed the FirstName of an entry to "abcurlф". Now I do in SQL Enterprise Manager: SELECT * FROM Employees WHERE (FirstName LIKE N'%ф%') and that returns exactly the row where I made that change. Note that an "N" is required before the search term - LIKE '%ф%' does not work.
  • 0 Votes
    6 Posts
    0 Views
    A
    PIEBALDconsult wrote: Sixth, abandon using stored procedures, they are nothing but trouble. That may be your opinion, but many large companies (certainly most financial institutions) insist on them for ease of deployment - if your sql is in your code (dll or whatever) and you have thousands of users worldwide, changes are far more complex than a single stored proc change (even if it does get replicated). Bob Ashfield Consultants Ltd
  • mySQL query question

    database question php sharepoint mysql
    8
    0 Votes
    8 Posts
    0 Views
    C
    Try the following select a.id ,a.upload_date ,a.office_id from ( select max(m.upload_date) max_upload_date ,m.office_id office_id from master m group by m.office_id ) tmp ,master a where a.upload_date = tmp.max_upload_date and a.office_id = tmp.office_id ; You need to be joining the table on itself, though it is more a view on itself. :) 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]
  • How to get the list of all dependent procedures?

    help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    M
    Hi Try the following: Link 1 : sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/[^] Or DECLARE @StringToSearch NVARCHAR(MAX) SET @StringToSearch = 'ENTER_SP_TO_SEARCH' SELECT [name], ( SELECT OBJECT_DEFINITION(obj2.object_id) AS [text()] from sys.all_objects obj2 where obj2.object_id = obj1.object_id FOR XML PATH(''), TYPE ) AS Obj_text, [type] as ObjType FROM sys.all_objects obj1 WHERE OBJECT_DEFINITION(object_id([name])) LIKE '%' + @StringToSearch + '%' Thanks Md. Marufuzzaman I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
  • Enumeration

    question
    3
    0 Votes
    3 Posts
    0 Views
    P
    I don't think databases have enumerations, but you can have a translation table and use referential integrity.
  • 0 Votes
    2 Posts
    0 Views
    M
    This tends to be a misleading, catch all error message. Assuming you actually have SQL installed and can see the database in SSMS then I would delete the credentials you are using and re create them. This may be cause by a restore from another server corrupting the user details. Never underestimate the power of human stupidity RAH
  • 0 Votes
    3 Posts
    0 Views
    M
    Here we go again, this article may be of use Pivot two or more columns in SQL Server 2005[^] This query basically represents the "inner" query in the article, now you need to extract the column labels to be pivotted on and write the outer query. I would stuff this query into a table var or view and work from there. Never underestimate the power of human stupidity RAH
  • Pivot table

    question
    4
    0 Votes
    4 Posts
    0 Views
    M
    That is precisely what I do in the article, buid a string of column headers from the data and build a pivot query based on that. Read the article! Never underestimate the power of human stupidity RAH
  • 0 Votes
    5 Posts
    0 Views
    D
    It's not the best database design in the world, so I agree with the others, your first approach should be to change the table design if you can. However, sometimes you don't have that option and the database design is out of your hands, so this link may help: http://www.kf7.co.uk/sql-server-function-get-numeric.aspx[^] You should be able to start from that and get something that works for you. It's not going to be fast, though.
  • Querying on null datetime

    database design help
    8
    0 Votes
    8 Posts
    0 Views
    W
    PIEBALDconsult wrote: In fact, why aren't you using DateTimePickers? Actually i am. I have a layered architecture and pass the datetime values as Nullable which allows me to send a null datetime to my SP. Anyways, Luc`s answer fits correctly for me. AND ( @frmdate IS NULL OR OrderedDate >= @frmdate } AND ( @todate IS NULL OR OrderedDate <= @todate ) Thanks again. When you fail to plan, you are planning to fail.
  • 0 Votes
    2 Posts
    0 Views
    _
    Script out your database and recreate it in SQL 2005 by running the script. Then import the data. I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! If you like cars, check out the Booger Mobile blog | If you feel generous - make a donation to Camp Quality!!
  • ADO.NET almost nullable column

    csharp database ai-coding help tutorial
    5
    0 Votes
    5 Posts
    0 Views
    M
    Yoyosch wrote: Sure sure, its the best to write everything in assembler or even machine code. Actually thats a bloody silly statement, I'm talking about the framework you use every day. Yoyosch wrote: ADO's designer saved me a lot of time during many years, this is first time it fails This would seem to indicate that you are doing fairly straight forward CRUD operations. We see this type of problem in the forums regularly, and yes it is generally something slightly different. IMHO it is not the productive issues, the designer/wizard stuff does make it quick and simple, it is the lack of any deep knowledge about your data and tools. Never underestimate the power of human stupidity RAH
  • Database Mail AS Exchange?

    database sql-server sysadmin question
    3
    0 Votes
    3 Posts
    0 Views
    M
    I dont think so SQL Server email service is not a good option as a mail server. Thanks Md. Marufuzzaman I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
  • Can't Query with = ISNULL?

    database help question
    9
    0 Votes
    9 Posts
    0 Views
    M
    Yep..I agreed Thanks. Thanks Md. Marufuzzaman I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
  • SELECT last date from database column entries !

    database tutorial csharp css
    4
    0 Votes
    4 Posts
    1 Views
    M
    Here is another alternative - no better, no worse just different. "SELECT TOP 1 [Closing Date]) FROM client_details WHERE [Closing Date] <= '"+textbox.text+"' order by [Closing Date] DESC" As Luc suggested use parameterized queries - this is IMPORTANT. There are usually a number of ways to sole a problem, try both and look at the execution plans to decide the better solution. Then throw an index on the close date field and see the difference! Never underestimate the power of human stupidity RAH
  • CLR stored procedure cross base access

    database dotnet question announcement
    2
    0 Votes
    2 Posts
    0 Views
    M
    You can have a use database statement in your proc. I have not idea how you do that in the clr, I have never turned it on, I use TSQL. You will find there are very few devs use the clr, most will use TSQL and sql servers SSMS tool. You do not need another layer of abstraction between you and your data. Never underestimate the power of human stupidity RAH
  • 0 Votes
    7 Posts
    0 Views
    R
    Just the answer I'm looking for! Thanks a lot Eddy! This really helped :) Rafferty
  • Sunday first last in week?

    database sql-server sysadmin question
    2
    0 Votes
    2 Posts
    0 Views
    S
    Solved my own problem! SET DATEFIRST 1; -- set's the first day of the week to monday SET DATEFIRST 7; -- set's the first day of the week to sunday I have no smart signature yet...
  • Goofy Question About SQL Server

    question database sql-server sysadmin sales
    11
    0 Votes
    11 Posts
    0 Views
    J
    Just a tip, you should include a status flag in that table while you are at it. This flag can have separate values for (for example) "Handled", "ImportError", "Corrupted", etc The most common problems when transferring data are data corruption, transfer failures, and import failures (usually because some data is in the wrong format or missing entirely, say a date may have the year 1900 instead of 2010, which happens astoundingly often). Based on the flag you can then have the import application take different actions (correct data with default values, alert someone, try to retrieve the data again from the source, etc.) My advice is free, and you may get what you paid for.