Forum Replies Created

Viewing 15 posts - 1,231 through 1,245 (of 1,419 total)

  • Reply To: Stored Procedure Documentation

    The type of the object (in C#) assigned to the SqlParameter is DataTable.  The SqlDbType is SqlDbType.Structured.

    SqlParameter lts = SqlCmd.Parameters.Add("@logged_times", SqlDbType.Structured);
    lts.Direction = ParameterDirection.Input;
    lts.Value = DataTableConverter.ToDataTable(model.Values);

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Merge statement not working as expected for bulk load.

    Jonathan AC Roberts wrote:

    I don't think the OP has explained very precisely what the problem is. Why do they only want ProductId 101? Why does this take presidency over ProductId 102? Why does...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Merge statement not working as expected for bulk load.

    Is it really necessary to use a merge statement?  Why not something like this?

    DROP TABLE IF EXISTS Test_Products;
    DROP TABLE IF EXISTS Test_UpdatedProducts;
    GO
    CREATE TABLE Test_Products(ProductIDint, ProductName varchar(10), Rate...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: SQL Server Name Convention and T-SQL Programming Style

    gserdijn wrote:

      <li style="list-style-type: none;">

    • Only use IF with BEGIN and END. That should be mandatory in my opinion.

    So this...

    if @x=1
    begin
    return 'xyz';
    end
    else
    begin
    return 'abc';
    end

    ...is preferable to?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Need Help formatting query to pull date-related data from Table

    These are temporal tables?  When you look at the table name in SSMS it says "TableName (System-Versioned)"?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Insert using select statements

    Is id the primary key of jobs?

    Is siteid the primary key of SiteAddresses?

    To get the columns from both tables onto a single row you could use CROSS JOIN.  It works...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Data Security

    Is this the documentation you're looking for?

    https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/enable-encrypted-connections-to-the-database-engine?view=sql-server-2017

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Can we send temp table as parameter from one store procedure to store procedure

    It's possible to pass a user defined table type to a stored procedure as a readonly parameter.  This code defines a table type called test_type1.  The procedure dbo.test_proc1 declares a...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: SQL Server Name Convention and T-SQL Programming Style

    The entire plural column is 'no' including temporal tables.  If tables are collections of rows then they should be plural, no?  If the table name is 'orders' then one row...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Are the posted questions getting worse?

    Thom A wrote:

    Steve Collins wrote:

    Lynn Pettis wrote:

    They have to want to help for the encouragement to work.  Not sure how to get someone who really doesn't want to contribute to do so.

    Just...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Are the posted questions getting worse?

    Lynn Pettis wrote:

    They have to want to help for the encouragement to work.  Not sure how to get someone who really doesn't want to contribute to do so.

    Just a few...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Hierarchies on Steroids #1: Convert an Adjacency List to Nested Sets

    An alternative to nested sets is nested json arrays.  Here it is using Jeff's (small) Employee table (renamed to dbo.Test_Employee)

    drop table if exists dbo.Test_Employee;
    go
    CREATE TABLE dbo.Test_Employee
    ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Find how many week day crossed in a given date

    To see if DesNorton's solution worked (it does) and to see if the interval could be created in Sql 2012 I tried with this sql although I don't have any...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Importing JSON

    By the way, I did have a script published here on SSC that includes an example of nested json arrays.  Please see:

    https://www.sqlservercentral.com/scripts/function-and-queries-to-convert-hierarchical-adjacency-to-nested-json-arrays

     

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Importing JSON

    Json_value() is used to access a single value of up to nvarchar(4000).  Openjson() is used to access arrays and can be nvarchar(max).  In the example json (with array []'s added)...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Viewing 15 posts - 1,231 through 1,245 (of 1,419 total)