Skip to content
  • 0 Votes
    5 Posts
    0 Views
    M
    Amazon Promo Code | Discount Vouchers | Discount Codes[^]
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    2 Posts
    0 Views
    Richard DeemingR
    Hey, it's not like one of my apps used the wrong SqlConnectionStringBuilder, which generated a connection string with the wrong version of the ApplicationIntent property for the SqlConnection I was using or anything. :doh: System[^] only supports ApplicationIntent; Microsoft[^] supports Application Intent or ApplicationIntent; the Microsoft connection string builder uses Application Intent. No idea why they had to change it though. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    11 Posts
    14 Views
    S
    Mycroft Holmes wrote: loop Loops are a last resort in databases. They are built to work on sets.
  • 0 Votes
    4 Posts
    0 Views
    OriginalGriffO
    That is a spectacularly bad idea, and most installations of SQL Server will not allow it - to do that you have to expose the whole DB server to the internet along with all the DBs it handles, with all the security problems that opens up! "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • 0 Votes
    9 Posts
    0 Views
    L
    Quote: I found a solution on the internet which fixes it. You can use a command of the form: INSERT INTO TableName (ColumnName) SELECT '" + value + "' WHERE NOT EXISTS ( SELECT ColumnName from TableName WHERE Name = '" + value + "')"; Followed by an ExecuteNonQuery(). [SQL Server Equivalent of MySQL INSERT IGNORE](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/14dc135d-8570-484b-9265-8e3c575e8e1b/sql-server-equivalent-of-mysql-insert-ignore?forum=sqlgetstarted) It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
  • 0 Votes
    3 Posts
    2 Views
    M
    I think it means that the SQL Server identity (not the user) does not have access to the network drive. I always move the file to the SQL Server server or loaded it via c#. Loading via c# I would put into a datatable EXACTLY matching the destination table and use BULKCOPY [^] to insert it into the destination Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
  • SQL Server 2010, smalldatetime insert

    Database help php database sql-server com
    4
    0 Votes
    4 Posts
    2 Views
    J
    I thought about what you both said, and would like to say thanks and show gratitude as well. I went back and keep the Select statement raw, took the convert out. The dumped my CRUD function to add the record, and converted the calling function to SQL. Then used PHP to convert the raw date object I picked up to a string, and declared it in SQL. I suppose I could go back to my add CRUD function and do the conversion there instead $result2 = sqlsrv_query($conn, $query2) or die(" setDbProjectCost " . __LINE__ . " - " . $query2 . " - " . print_r(sqlsrv_errors())); if (sqlsrv_has_rows($result2)) { $row2 = sqlsrv_fetch_array($result2); $addDateString = $row2[13]->format('Y-m-d H:i:s') . '.000'; $query3 = " DECLARE @addDate AS VARCHAR(33) = '$addDateString'; INSERT INTO \[proj\_cost\] VALUES ... @addDate If it ain't broke don't fix it Discover my world at jkirkerx.com
  • 0 Votes
    35 Posts
    0 Views
    M
    I have that book the inmates are running the asylum it's an interesting read, especially 22 years after it was written. things haven't changed much.
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • 0 Votes
    10 Posts
    3 Views
    R
    Good to know. Thanks. I've been reading about it and will do more research.
  • Accounting problem in SQL

    Database database sql-server help tutorial question
    3
    0 Votes
    3 Posts
    2 Views
    C
    I guessing that by Quote: Creditor documents cover debtor documents. you are implying that there may be more than one credit document to cover debt documents. You are essentially trying to keep a running total (hint - good thing to google for). But first you have to get your data into a useable form. In the example below I am going to DocID to indicate the order in which the documents were received because the data you have in columns docDate is not a date and I can't use it in an order by clause. The first step is to get all of the documents into a single result set - I'm not sure why you have columns ISDeb/IsDebit when you can tell what they are by what table they are in. Personally, I would have had one transaction table with all types of transaction in the one place, with debit values negative and credit values positive. But as you have a different model, you will need to start with something like this ... select personID, DocDate, DocID, (-1) * Fee As Fee, IsDebit from #debit union all select personID, DocDate, DocID, Fee, ISDeb from #credit There are several ways to calculate a running total e.g. you could adapt one of the solutions from this post[^] ;with combine as ( select personID, DocDate, DocID, (-1) * Fee As Fee, IsDebit from #debit union all select personID, DocDate, DocID, Fee, ISDeb from #credit ) ,CTE as ( select T.personID, T.DocDate, T.DocID, T.Fee, T.Fee as running_total from combine as T where T.DocID = 1 union all select T.personID, T.DocDate, T.DocID, T.Fee, T.Fee + C.running_total as running_total from CTE as C inner join combine as T on T.DocID = C.DocID + 1 ) select C.PersonID, C.DocDate, C.DocID, C.Fee, C.running_total from CTE as C Which gave results PersonID DocDate DocID Fee running_total 88 2/14 1 -5 -5 88 2/15 2 -5 -10 88 2/16 3 3 -7 88 2/17 4 7 0 This strikes me very much as homework, so just be aware that your tutor probably knows about this site as well That still doesn't get the results you want - you need to start looking at PIVOT to get credit fee and debit fee on the same row - but for that you are go
  • 0 Votes
    2 Posts
    3 Views
    S
    Make sure you have an index on RefDate. Probably another one on FormatCode and AcctName. Beyond that, you need to use the database tools to track down which part is taking the most time. If it is Microsoft Sql Server then you can use the Estimated Execution Plan and other tools.
  • 0 Votes
    2 Posts
    0 Views
    L
    If you installed it with package manager, I would inspect it under package manager; and then update or reinstall. Or look under "Windows". Or under Tools. Or Data. Or, restart VS in "default mode". Reinstall VS. etc. It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
  • 0 Votes
    9 Posts
    0 Views
    OriginalGriffO
    :thumbsup: "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • Interval schedule

    Database sql-server algorithms tutorial
    4
    0 Votes
    4 Posts
    2 Views
    M
    This is EXACTLY what I needed. This was far too complex for me to comprehend, so I started to look into why it works and breaking down everything in piece. No comments in anything for the query below, but should be able to figure it out for someone looking at the same thing: SELECT DATEDIFF(HOUR, '1:00', '23:00') SELECT DATEDIFF(HOUR, '1:00', '23:00') / 4 SELECT (1 + DATEDIFF(HOUR, '1:00', '23:00')) / 4 SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS N FROM sys.all_columns SELECT TOP ((1 + DateDiff(hour, '1:00', '23:00')) / 4) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) As N FROM sys.all_columns SELECT DATEADD(HOUR, 5 * 4, '1:00') As ScheduleTime UNION SELECT DATEADD(HOUR, 4 * 4, '1:00') As ScheduleTime UNION SELECT DATEADD(HOUR, 3 * 4, '1:00') As ScheduleTime UNION SELECT DATEADD(HOUR, 2 * 4, '1:00') As ScheduleTime UNION SELECT DATEADD(HOUR, 1 * 4, '1:00') As ScheduleTime SELECT ',' + CAST(T.ScheduleTime As char(5)) FROM /* Tally table: */ ( SELECT TOP ((1 + DateDiff(hour, '1:00', '23:00')) / 4) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) As n FROM sys.all_columns ) As N /* Generated schedule: */ CROSS APPLY ( SELECT DateAdd(hour, N.n * 4, '1:00') As ScheduleTime ) As T FOR XML PATH('') I had to make an adjustment to the final query though to make sure I was getting a schedule for a 24 hour period instead from the start time to midnight: WITH cteSource As ( SELECT CAST('13:00' As time) As StartTime, 4 As Hours UNION SELECT CAST('01:00' As time) As StartTime, 7 As Hours ) SELECT StartTime, Hours ,STUFF(T.ScheduleTime, 1, 1, '') As ScheduleTime FROM cteSource As S CROSS APPLY ( SELECT ',' + CAST(T.ScheduleTime As char(5)) FROM /\* Tally table: \*/ ( SELECT TOP (24 / S.Hours) ROW\_NUMBER() OVER (ORDER BY (SELECT NULL)) As n FROM sys.all\_columns ) As N /\* Generated schedule: \*/ CROSS APPLY ( SELECT DateAdd(hour, N.n \* S.Hours, S.StartTime) As ScheduleTime ) As T FOR XML PATH('') ) As T (ScheduleTime)
  • Spam article?

    Spam and Abuse Watch csharp database mysql sql-server
    2
    0 Votes
    2 Posts
    0 Views
    J
    . "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
  • SqlServer (and ADO.NET) mystery...

    Database csharp database sql-server linq com
    4
    0 Votes
    4 Posts
    2 Views
    M
    Also take a look at parameter sniffing[^]. I know it is weird but it does make a difference sometimes. Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP