dcsimg

Search:

Type: Posts; User: GaryMazzone

Page 1 of 13 1 2 3 4

Search: Search took 1.83 seconds.

  1. Replies
    8
    Views
    194

    Re: Trigger keeps inserting duplicates

    i would check that the data doesn't exist yest
  2. Replies
    8
    Views
    194

    Re: Trigger keeps inserting duplicates

    What is this trying to do... very insert puts a row in inserted and you are looking there for a record and then inserting again
  3. Re: An interesting query based on a date buried in a big long string

    Not avail on the version of SQL we are using. Also the field is 1024 but the input could be truncated during the insert so I don't always get properly formed JSON
  4. Re: An interesting query based on a date buried in a big long string

    Dumping that all into a single blob string is difficult to work with (believe me I know) here we are using a product from solarwinds named syslogger
    it dumps log files into a table in one field......
  5. Re: An interesting query based on a date buried in a big long string

    Can you use string split..... string_split(bigstring,' ')
    then look for date
  6. Replies
    12
    Views
    459

    Re: substring begin end

    try something like this (this is for sql server)



    DECLARE @string VARCHAR(500) = 'heloooblaAblblbsdf&TransactionId=1231234&Trmkdf$hellooo'

    SELECT...
  7. Re: Permissions required for executing stored procedures on SQL Server

    I normally create a role (in each DB) call Executor then grant execute ob SPs to that role. Then assign users to the role, same as db_datareader and db_datawriter
  8. VS 2017 Re: Copy records from 1 database to another

    I've had this happen more than once. I restored to a DB on different sever. Then used SSIS packages with required vars (user, date ranges) and compared for missing in range and use the result to...
  9. Replies
    61
    Views
    1,030

    Re: What was your last purchase?

    Mine was a shoulder repair and I agree with Shaggy, no one needs or wants to see that
  10. Replies
    12
    Views
    543

    Re: Sql Server copying table

    You can start with this and convert it to a create table using the results


    SELECT
    COLUMN_NAME AS [Field Name] ,
    DATA_TYPE AS [Data Type] ,
    ...
  11. Re: SQL Server not increasing by 1 but by 100

    Think of an FK (foreign Key) as it must reside in the parent table before it can reside here (i.e. Let say you have a row in the parent table with and ID of 1000 (as the primary key in you customer...
  12. Re: SQL Server not increasing by 1 but by 100

    You didn't by some change do in insert with INDETITY_INSERT On then insert into the ID column and at the end do IDENTITY_INSERT OFF did you? If so the identity will have been reset to the last value...
  13. Re: SQL Copy binary data from one table to another

    I would say take the backup, restore it somewhere (ensureing that it works) then run all code on that multiple times before prod, but I was still worried when I did prod live
  14. Re: SQL Copy binary data from one table to another

    Yes when I was migrating an 50 million row table to a new table structure :eek:
  15. Re: SQL Copy binary data from one table to another

    If the field name is FILE I would with the query like this


    UPDATE T2 SET
    T2.[FILE] = T1.FILE
    FROM Table2 T2
    INNER JOIN Table1 T1
    ON T2.ID = T1.ID
  16. Re: Subtract date and time fields in SQL Server query

    Funky the thanks is appreciated. Rep is OK but a thanks is better :):wave:
  17. Re: Subtract date and time fields in SQL Server query

    Lets not forget DATETIMEOFFSET... I have to use this since we are across time zones. We always store UTC datetime and then use AT TIMEZONE 'XXXX' to display the local time
  18. Replies
    7
    Views
    491

    Re: Two Rows in one

    Then your way is the best method for that (using the CTE)
  19. Replies
    7
    Views
    491

    Re: Two Rows in one

    I've used it on some table with over 60,000,000 and been OK. just very sparingly
  20. Replies
    7
    Views
    491

    Re: Two Rows in one

    You can also combine all the data into one column if needed (well by that I mean the data you want in one column). Is this SQL Server?
    If so you can use a stuff command with a query with for XML...
  21. Replies
    8
    Views
    495

    Re: tableadapter set to limit

    For MySQL if you want the last 30 records only then you need 2 parts to the query the Order By columnName DESC and LIMIT 30.

    This is give the last 30 of something

    Say we have a table called...
  22. Replies
    5
    Views
    385

    Re: [RESOLVED] Easy SQL Question?

    So was the error with your SQL statement? Was it a select, was it an insert? Invalid Cursor implies you are doing a select for a cursor but I don't know... the statement would have been nice to...
  23. Replies
    8
    Views
    526

    Re: Secure Connection to SQL Server

    There is something in SQL Server 2016 and up called Always-Encrypted. That encrypts data end to end have you looked at that?
  24. Re: How to cancel long running TableAdapter Fill query

    That depends on the query... if it is just a select probably not (it will stop running and there is nothing to un-do, unless of course you are using temp tables and that need to be undone). If you...
  25. Re: How to cancel long running TableAdapter Fill query

    To kill the query at the database level you need to know the SPID of the query, then need admin rights to issue KILL SPID# to the database
  26. Replies
    17
    Views
    1,765

    Re: How To Use Between Is Select Statement

    That is because the date is a datetime value. When you pass just the date it assumes you mean midnight so 11/22/2019 is queried as 2019-11-22 00:00:00 and you entry for 2019-11-22 is 20:31:31 so it...
  27. Re: Setting up SQL Server on a remote server

    Are your domain cred set up on the system? I know that my normal credentials (the one I use daily) is not. In fact it is a different domain than our DB servers live in. So I can't use integrated...
  28. Replies
    9
    Views
    768

    Re: Aggregate Days

    I would sum the count field and group by the date of the datetime (just using the date) the Cast of the DateTime to Date should be OK for response time I would think
  29. Replies
    9
    Views
    768

    Re: Aggregate Days

    Could you convert the timestamp to a date (using Cast) then use the DATEPART function (maybe use DAYOFYEAR)?
  30. Replies
    17
    Views
    1,765

    Re: How To Use Between Is Select Statement

    I normally take the last date supplied (just ask for the date) and do a dateAdd (DAYS,1,suppliedDate) and use >= and <
  31. Replies
    8
    Views
    370

    Re: How to Query SQL programmatically

    We have 2 main applications where I work.... One uses in-line SQL (written by Nhibernate) and the other Stored Procs that the DBAs vet. When something goes wrong in the one with in-line SQL we are...
  32. Replies
    8
    Views
    370

    Re: How to Query SQL programmatically

    It also allows the reuse of query plans much better
  33. Replies
    6
    Views
    570

    Re: linking tables in a database

    Do this mean you want one table to be the Primary side of a relationship to more than one table? If that is the question then Yes
    If you mean can one table (child) have a key to two different...
  34. Replies
    11
    Views
    449

    Re: Insert time into sql database

    or


    DECLARE @dtTime DATETIME = GETDATE();
    DECLARE @dtTime2 TIME
    DECLARE @MyTime VARCHAR(30)

    SET @dtTime2 = @dtTime
    SELECT @dtTime2
    SELECT CONVERT(varchar(30),@dtTime,108)
  35. Replies
    11
    Views
    449

    Re: Insert time into sql database

    DECLARE @dtTime DATETIME = GETDATE();
    DECLARE @MyTime VARCHAR(30)


    SELECT CONVERT(varchar(30),@dtTime,108)
    SELECT @MyTime = CONVERT(varchar(30),@dtTime,22)
    SELECT SUBSTRING(@MyTime,CHARINDEX('...
  36. Replies
    11
    Views
    449

    Re: Insert time into sql database

    Yes it does
    See this page: https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver15
  37. Replies
    11
    Views
    449

    Re: Insert time into sql database

    You use the format command or CONVERT(VARCHAR(X),fieldname,format type)

    There is a web page in MSDN for Convert formats
  38. Re: Question related to importing data from old sql server db

    Version numbers for SQL Server
    6.5 SQL Server 6.5
    7.0 SQL Server 7
    8.0 SQL Server 2000
    9.0 SQL Server 2005
    10.0 SQL Server 2008
    10.5 SQL Server 2008R2
    11.0 SQL Server 2012
    12.0 SQL Server...
  39. Re: Question related to importing data from old sql server db

    Still might have problems going 2000 to 2012... I'm not sure that even imports to 2008R2. still might need to update to 2005 and then to 2012
  40. Re: Question related to importing data from old sql server db

    If it is 6.5 I do not think you can import directly to 2012 (even with a .bak). you would need at least one version between them (it might import to a 2005) then from there to 2012
Results 1 to 40 of 500
Page 1 of 13 1 2 3 4



Featured


Click Here to Expand Forum to Full Width