Tag: sql-server

Finding the frequency of repetation of Material pairs in Sales order and order them by Frequency in SQL Server

my data looks like shown below.I want to create material pairs Sales Order Wise which is being ordered frequently in SQL Server I used the below code but I see duplicates in the output. SALES_ORDER- ITEM_NO- MATERIAL_NUMBER<br> 160608048 10 EU-SAC-00820<br> 160608047 10 EU-174000-000200<br> 160608047 20 EU-174000-000180<br> 160608047 30 EU-174000-000220<br> 160608042 10 EU-A-6000-08LF<br> 160608040 10 EU-A-6000-08LF<br> […]

How do I look for my Server Name for SQL Server Managment Studio v17. RC1?

I need to establish a connection, but I need to provide my Server Name and it seems that I keep getting it wrong. I tried using Command Prompt and the command ipconfig and use the Ip as the Server Name as someone told me to do, but it didn’t work.

Display view content in SQL Server

In my SQL Server when I create a view with 3 tables that have foreign keys to each other, this view does not show my tables contents. I try that with different tables and it does not show content when the tables are more than 2! How can I fix that? My SQL Server

Finding consecutive weeks person appears in table

I need to find how many consecutive weeks a person appears in a table, starting with the current week. The table has an ID and an insert date. If a person is inserted into the table, I need to calculate if they were there the prior week and if so how many consecutive weeks prior […]

The specified DSN contains an architecture mismatch between the Driver and Application,

Here is the exception that I am getting: ErrorException in DocketController.php line 65: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, And here is the Docketcontroller.php line number 65: // Localhost $dsn = “test2”; $conn=odbc_connect($dsn, “QA”, “QA”); if (!$conn) { exit(“Connection Failed: ” . $conn); […]

SQL Server return sequence next value as view column

Say I have a Collection of MS SQL Server sequences and want to return the name, current value and next value of the sequences as the columns of a view, hence increasing a sequence each time it is contained in a result, how do I define the view? select * from SEQUENCE_VIEW NAME CURRVALL NEXTVAL […]

How to perform “select top 1 x from table” statement in spark sql

I am facing problem converting bellow query in spark-sql in pyspark SQL-server query is coalesce((Select top 1 f2.ChargeAmt from Fact_CMCharges f2 where f2.BldgID = f.BldgID and f2.LeaseID = f.LeaseID and f2.IncomeCat = f.IncomeCat and f2.Period < f.Period and f2.ActualProjected = ‘Lease’ order by f2.Period desc),0) as Charge I did not find replacing key word of […]

How to get information from SQL table with php

So i’ve created a database on SQL, i’m trying to get information (id,title and date)out of one of the tables i need and make an html element of it but when i run the function nothing happens. <?php function getTitles (){ $conn; $sql=’SELECT * FROM `thumbnails`’; $statement = $conn->prepare($sql); $statement->bindValue(“:title_id”,$title_id); $statement->execute(); $titles = $statement->fetchAll(); $output=”; […]

“Call to undefined function sqlsrv_connect()” in Wamp, drivers installed

This question already has an answer here: Call to undefined function sqlsrv_connect() with WAMP 3 answers

how to use other, previous, values to create a new value

This is my first post having found so much of what I have needed previously by searching this site. I can’t find an answer to this one, so here we go…I have a table containing the number of customers for around 40 organisations listed by month, sample as follows: Month OrgID Cust 201509 G85001 12731 […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.