How to generate and manually insert a uniqueidentifier in SQL Server?

ApplicationId must be of type UniqueIdentifier. Your code works fine if you do: DECLARE @TTEST TABLE ( TEST UNIQUEIDENTIFIER ) DECLARE @UNIQUEX UNIQUEIDENTIFIER SET @UNIQUEX = NEWID(); INSERT INTO @TTEST (TEST) VALUES (@UNIQUEX); SELECT * FROM @TTEST Therefore I would say it is safe to assume that ApplicationId is not the correct data type.

PostgreSQL HASH index

Hashes are faster than B-Trees for cases where you have a known key value, especially a known unique value. Hashes should be used if the column in question is never intended to be scanned comparatively with < or > commands. Hashes are O(1) complexity, B-Trees are O(log n) complexity ( iirc ) , ergo, for … Read more

Loop n times without using a stored procedure

MySQL docs on Flow Control Statements say: MySQL supports the IF, CASE, ITERATE, LEAVE LOOP, WHILE, and REPEAT constructs for flow control within stored programs. Docs on Stored Programs and Views say: Stored program definitions include a body that may use compound statements, loops, conditionals, and declared variables. Compound-Statement Syntax This section describes the syntax … Read more

Explode (transpose?) multiple columns in Spark SQL table

Spark >= 2.4 You can skip zip udf and use arrays_zip function: df.withColumn(“vars”, explode(arrays_zip($”varA”, $”varB”))).select( $”userId”, $”someString”, $”vars.varA”, $”vars.varB”).show Spark < 2.4 What you want is not possible without a custom UDF. In Scala you could do something like this: val data = sc.parallelize(Seq( “””{“userId”: 1, “someString”: “example1”, “varA”: [0, 2, 5], “varB”: [1, 2, … Read more

SQL Server 2008 Unique Column that is Case Sensitive

The uniqueness can be enforced with a unique constraint. Whether or not the unique index is case-sensitive is defined by the server’s (or the table’s) collation. You can get the current collation of your database with this query: SELECT DATABASEPROPERTYEX(‘AdventureWorks’, ‘Collation’) SQLCollation; and you should get something like: SQLCollation ———————————— SQL_Latin1_General_CP1_CI_AS Here, the “CI_AS” at … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)