I am looking for a way to count the number of columns in a table in Hive. I know the following code works in Microsoft SQL Server. Is there a Hive equivalent? SELECT COUNT(*), FROM …
Tag: sql-server
t-sql string unique ID (Northwind database)
I’ve been trying to get this right for some time now with no use. I have a table in mssql database and I want to insert new row using stored procedure The problem is CustomerID field which contains unique string for each record (ALFKI, BERGS, BERGS, etc.) I want to make a stored procedure which will ins…
How to export all data from table to an insertable sql format?
I have a Table (call it A_table) in a database (call it A_db) in Microsoft SQL Server Management Studio, and there are 10 rows. I have another database (call it B_db), and it has a Table (call it B_table), which has the same column settings as A_table has. But the B_table is empty. What I want: Copy every row…
Transform and group row data into columns
I’m looking for a way to combine different rows into a single row with columns. Let’s take this example table: Desired output: Please note that Data centers are not necessarily these three, they can be N different data centers that I will not know in advance. Answer With a known set of sourceDataC…
SQL INSERT INTO from multiple tables
this is my table 1: this is my table 2: and now I want a table 3 which shows me all information: I tried first to insert into table 3 only the values from table 1 and then I inserted into table 3 the values from table 2 with an inner join where Id = Id is. But all I
How to set a connection from eclipse to SQLServer?
I am trying to connect to SQL Server from eclipse and i get the following error. I mention that i verified and the SQL Server Browser is running on the host and i have no firewall active. This is the code i’ve written: Answer First thing before DB programming. Test each “step”. Before execut…
Sql Server 2008 Update query is taking so much time
I have a table name Companies with 372370 records. And there is only one row which has CustomerNo = ‘YP20324’. I an running following query and its taking so much time I waited 5 minutes and it was still running. I couldn’t figure out where is the problem. Answer You don’t have trigger…
How to insert rows to value
Have table with values refl value have parametres like : I want to select all data which is in refl to another value declare @val nvarchar(4000) . Is it possible ? When I try select @val = refl from #tbl it select only last row, I want to select all rows. How do it? It must be like Answer Try
Avoid duplicates rows which have one different column value in SQL Server
I have a view like this . I’m using SQL Server. formId name mark 100 Rob N 101 Rob N 101 Rob C 105 Jane N 106 Jane N view name: …
PHP Return ID[uniqueidentifier] after sql INSERT
Like the title says, I want the id of a row to be returned after INSERT to the database. I’ve got 2 functions, one to make a connection to the database: And one to insert a new record: I need the last function to return the ID of the inserted row, how should I do this? EDIT: Like the title