Skip to content

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
  • how to updat a column from start point

    tutorial question announcement
    13
    0 Votes
    13 Posts
    0 Views
    N
    Hi, Try this : ColumnA is the primary key of table : tableName UPDATE tableName SET columnB = 9 + t2.RowNum FROM tableName t1 INNER JOIN ( SELECT ROW_NUMBER() OVER (ORDER BY columnA) RowNum,columnA FROM tableName) t2 ON t1.columnA = t2.columnA
  • 0 Votes
    6 Posts
    0 Views
    N
    Hi, Try below : DECLARE @JoiningDate DATE SET @JoiningDate = '10/10/2013' IF (YEAR(GETDATE()) > YEAR(@JoiningDate)) BEGIN IF (DAY(@JoiningDate) = DAY(GETDATE()) AND DAY(@JoiningDate) = DAY(GETDATE())) BEGIN /* This will exceute on every year of joining date. Below is the print statement to check the testing result. */ PRINT CONVERT(NVARCHAR,(YEAR(GETDATE()) - YEAR(@JoiningDate))) + ' Year(s)' END END
  • 0 Votes
    13 Posts
    0 Views
    N
    If you want to excecute your query on every 31st December add a below condition IF (MONTH(GETDATE()) = 6 AND DAY(GETDATE()) = 16) BEGIN --Write down your query END
  • 0 Votes
    2 Posts
    1 Views
    Kornfeld Eliyahu PeterK
    Simply the error means that the machine you try to connect is exists but no SQL server (service) can be found on it... 1. check that the machine name/ip address is the right one 2. SQL installed as named instance? In that case you may add the instance name to your address 3. SQL using the default port (1433) or it installed with a different one? 4. You may have a firewall between you and the SQL, check it and open ports as needed... I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
  • 0 Votes
    3 Posts
    0 Views
    J
    I just figured it out! It was the PDF generator, in which the number was being formatted correctly, but the space I allocated for the data was not wide enough, so somehow it truncated the decimal values after the . That was a head scratcher that I spent hours on this morning. But thanks for the response and help, appreciate it. :)
  • SSRS With SSIS

    sql-server help question
    2
    0 Votes
    2 Posts
    0 Views
    S
    Yes We can call ssrs reports from ssis.First you have to publish your reports on to reports server manager.But dont schedueled It.And In your ssis package you have add one script task and call your ssrs from script task.
  • XQuery and Namespace

    database xml tutorial
    4
    0 Votes
    4 Posts
    0 Views
    M
    kjfoley1 wrote: I'm working in SQL unless I'm missing something No but it is Richards job/privilege as a protector to reduce cross posting, which this may not be. Sorry to not be of any use - I hate xml. Never underestimate the power of human stupidity RAH
  • 0 Votes
    3 Posts
    0 Views
    B
    :) :) thank you very much,i will try again!
  • How to get the Output based on Next Date if exists in the Table

    tutorial
    7
    0 Votes
    7 Posts
    0 Views
    B
    How do you expect us to find out code for that transformation if you refuse to tell us the transformation rules?
  • 0 Votes
    9 Posts
    0 Views
    H
    Oh i got it now. Actually I had not understood it properly. Thanks for making it clear anyway. Definitely this would be a good approach than keeping SQL Job Schedules like you said.
  • Regarding case control statement in mysql

    mysql help question announcement
    5
    0 Votes
    5 Posts
    0 Views
    A
    Thank You very much it worked.
  • datatype mapping

    csharp mysql
    5
    0 Votes
    5 Posts
    0 Views
    G
    ohh thank you so much, now i understand it.
  • SQL Server and ADO.net IsolationLevel

    csharp database sql-server visual-studio com
    3
    0 Votes
    3 Posts
    0 Views
    P
    Eddy Vluggen wrote: if they are values Right, just simple insertion of values, no reading. You'll never get very far if all you do is follow instructions.
  • Question on Canidate keys and functional dependecies

    com question
    3
    0 Votes
    3 Posts
    0 Views
    L
    Member 10865129 wrote: more importantly HOW you got 0 NF: Attorney ClientNumber ClientName MeetingData Duration Boxer 1000 ABC, Inc 11/5/13 2 Boxer 2000 XYZ Partners 11/5/13 5.50 James 1000 ABC, Inc 11/7/13 3 Boxer 1000 ABC, Inc 11/9/13 4 Wu 3000 Malcomb Zoe 11/11/13 7 1 NF: * Remove all calculated facts * Assign a key * Move repeating groups to their own table (key is underlined) Attorney ClientNumber MeetingData Duration Boxer 1000 11/5/13 2 Boxer 2000 11/5/13 5.50 James 1000 11/7/13 3 Boxer 1000 11/9/13 4 Wu 3000 11/11/13 7 ClientNumber ClientName 1000 ABC, Inc 2000 XYZ Partners 3000 Malcomb Zoe 2 NF: * Find the attributes that are not "functionally dependent" on the entire key That means that we look at each non-key field and ask ourselves whether or not it is depending on the entire key, or whether it can be identified with a part of that key. The only non-key field in "Meetings" is called "Duration". The duration "2" belongs to the meeting that's identified with all three fields, so there's no functional dependency there. In the original table the duration could depend on a part of the key; my mistake. 3NF: * Find non-key fields that depend on other non-key fields. There's none. One might argue that the Attorney is also a repeating group, and put it in it's own table with an artificial key. Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
  • Join Query returning duplicated rows

    database sql-server question
    3
    0 Votes
    3 Posts
    0 Views
    N
    Dear, It happens only when the multiple records are available with the correspondence of [Sheet1$].Id into the [Sheet2$] ([Sheet2$].Sheet2Id) Or [Sheet3$] ([Sheet3$].Sheet3Id). Please check with the multiple records into the Both the Sheet 2 & 3. If you dont want to remove the multiple records from those sheets then Add distinct clause into the SELECT Query. SELECT DISTINCT [Sheet1$].Sheet1DetailId, [Sheet1$].Sheet1Id, [Sheet2$].Sheet2Id, LTrim(RTrim([Sheet3$].Mission)) + '-' + CStr(Format('01-' + [Sheet3$].Sheet3Date,"mm/dd/yyyy")) AS Sheet3DateColumn, [Sheet1$].one, [Sheet1$].two, [Sheet1$].three, [Sheet1$].four, [Sheet1$].five, [Sheet1$].six, [Sheet1$].seven, [Sheet1$].eight, [Sheet1$].nine, [Sheet1$].ten, LTRIM(RTRIM([Sheet2$].Name)) AS Sheet2Name FROM (([Sheet1$]) INNER JOIN [Sheet2$] ON [Sheet1$].Id = [Sheet2$].Sheet2Id) INNER JOIN [Sheet3$] ON [Sheet1$].Id = [Sheet3$].Sheet3Id
  • 0 Votes
    7 Posts
    0 Views
    P
    And if the workload isn't too heavy you could use a Web Service (WCF or similar) to provide a single access point so the clients don't actually touch the database. The service could then perform the actions one-by-one. You'll never get very far if all you do is follow instructions.
  • SQLite query

    database sqlite
    3
    0 Votes
    3 Posts
    0 Views
    D
    Mycroft Holmes wrote: Sorry I missed the SQL Lite platform in the title :O That's okay. I could've qualified it further by stating it's running on an Android platform. "One man's wage rise is another man's price increase." - Harold Wilson "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • + operaotor for outer joins in mysql.

    help mysql question
    2
    0 Votes
    2 Posts
    0 Views
    J
    I'm pretty sure MySQL isn't supporting outer implicit joins, only inner implicit joins. You'll have to use an Ansi Join instead. Wrong is evil and must be defeated. - Jeff Ello[^]
  • 0 Votes
    1 Posts
    1 Views
    No one has replied