I have a couple of SQL databases that i am trying to link results from. My first database is calendar that i need to return the details for today so current date and targets for sales and orders that works my second data base is for orders which i can sum the total orders for today and add that to a column on the select statement (code below) but the trouble started when i want to add another column with total orders for the period so far using periodstartdate and currentdate from database 1. any help would be great USE …

Member Avatar
+0 forum 0

I am using a code similar to the one below inside my stored procedure: [CODE]declare @tempVar decimal select @tempVar = amount from tempTable where <<conditions>> IF (CONDITIONAL STATEMENT) BEGIN select @tempVar END [/CODE] now I am supposed to be getting 4.25 something and I get 4, when I can clearly see in the table that this particular value is not just 4. So why is the rounding take place? Anybody know what I am missing here?

Member Avatar
Member Avatar
+0 forum 3

I am having a table with nvarchar feild in which values are entered like 1 4 8 25 I want a sql query to find the missing sequence of number in the above series... Thanks in advance...

Member Avatar
Member Avatar
+0 forum 5

One computer can install multiple versions of Microsoft Visual Studio 2005, 2008, 2010, ... so SQL Server Management Studio can install multiple versions of 2005, 2008, ... the same computer ?

Member Avatar
Member Avatar
+0 forum 1

Hi everyone, I have database which has data of past 2 years. I want to get that data for current financial year. [COLOR="Green"](Here financial year is 1st april to 31st of March)[/COLOR] This query returns data for current calender year i.e. [Jan-to-Dec] [COde=sql] SELECT DATENAME(MONTH, DATE) AS MonthName, SUM(NetAMOUNT) AS dsfd from SALESMASTER GROUP BY DATEPART(MONTH, DATE), DATENAME(MONTH, DATE) ORDER BY DATEPART(MONTH, DATE)[/COde] I want to see the same data in the form of financial year i.e. [April-to-March] just take care financial year involves 9 months of previous year and 3 months of current year. please reply..

Member Avatar
Member Avatar
+0 forum 4

All information related upcoming ERP Cloud systems by Oracle

Member Avatar
Member Avatar
-2 forum 2

The second annual Imperva Hacker Intelligence Initiative report, this one entitled [Monitoring Hacker Forums](http://www.imperva.com/docs/HII_Monitoring_Hacker_Forums_2012.pdf), is out and reveals that the threat surfaces being discussed by the hacker community are very different from those that businesses are spending money on defending against attack. ![dweb-hackers](/attachments/small/0/dweb-hackers.jpg "align-right") The Imperva research analysed the content of a number of online hacker communities, including many lesser known forums in order to get a more accurate snapshot of what those doing the hacking are actually discussing. By looking at a total of more than 400,000 different conversational threads, Imperva was able to determine that SQL injection and …

Member Avatar
Member Avatar
+0 forum 2

I am trying to connect to a Microsoft SQL server database using PHP 5.6 and am getting the error "could not find driver". I am initially attempting to use PDO but I could use the procedural version if necessary. I have downloaded the SQL server PHP driver and placed it in the ext folder in my PHP installation. I have also specified the extension in php.ini. My web server is IIS 7. My platform is Windows 7 Professional (the same box for both the database and the web servers). PHP is executed correctly by IIS. I think I must be …

Member Avatar
Member Avatar
+0 forum 2

We have built a software web-portal (POS system) in PHP language. Which is working fine when online. But when the internet goes down in the stores, the software stops completely and the managers are not able to make bills till the time internet is live again! Hence we want to build an offline module, which involves local server setup (wamp or easy-PHP)and deploying the code offline on the local machine/PC The problem we are facing is syncing the offline and online MySQL databases. Moreover, there are 6 different stores which will be running the offline billing module hence the problem …

Member Avatar
Member Avatar
+1 forum 2

How do i format my Query result so it has thousand seperator and only to 2 decimal places <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Daily Sales</title> <link rel="stylesheet" href="../styles/login.css" media="all" /> </head> <body class="normal"> <?php include("../includes/x3connect.php"); ?> <?php $sql="SELECT SUM (CASE WHEN FFP.BPARTNER.CUR_0='GBP' THEN (FFP.SORDERQ.YORIQTY_0 * FFP.SORDERP.GROPRI_0) ELSE ((FFP.SORDERQ.YORIQTY_0 * FFP.SORDERP.GROPRI_0) * FFP.SORDER.CHGRAT_0) AS MONEY END) FROM FFP.SORDER INNER JOIN FFP.BPARTNER ON FFP.SORDER.BPCORD_0 = FFP.BPARTNER.BPRNUM_0 INNER JOIN FFP.SORDERP ON FFP.SORDER.SOHNUM_0 = FFP.SORDERP.SOHNUM_0 INNER JOIN FFP.SORDERQ ON FFP.SORDER.SOHNUM_0 = FFP.SORDERQ.SOHNUM_0 WHERE FFP.SORDER.YFPSODAT_0=DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) and FFP.SORDER.SOHTYP_0!='SO6' and FFP.SORDER.YFPSOSO_0=2 and …

Member Avatar
Member Avatar
+0 forum 1

Hi I have the following code that i can run in MSSQL Query and the result are returned correctly but when i try to run it in PHP it errors what do I need to change to get it to work please. SELECT SUM (CASE WHEN FFP.BPARTNER.CUR_0='GBP' THEN (FFP.SORDERQ.YORIQTY_0 * FFP.SORDERP.GROPRI_0) ELSE ((FFP.SORDERQ.YORIQTY_0 * FFP.SORDERP.GROPRI_0) * FFP.SORDER.CHGRAT_0) END) FROM FFP.SORDER INNER JOIN FFP.BPARTNER ON FFP.SORDER.BPCORD_0 = FFP.BPARTNER.BPRNUM_0 INNER JOIN FFP.SORDERP ON FFP.SORDER.SOHNUM_0 = FFP.SORDERP.SOHNUM_0 INNER JOIN FFP.SORDERQ ON FFP.SORDER.SOHNUM_0 = FFP.SORDERQ.SOHNUM_0 WHERE FFP.SORDER.YFPSODAT_0=DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) and FFP.SORDER.SOHTYP_0!='SO6' and FFP.SORDER.YFPSOSO_0=2 and FFP.BPARTNER.CUR_0='GBP'

Member Avatar
Member Avatar
+0 forum 2

I have a website name onlinecheckwriter.com which helps my client to print check online. Right now I'm facing one problem that I didnt find any vendor that provide offical routing never verification api. Right now our customer add routing number but I need cross check it with bank . So I'm looking for a paid api that will give me accurate information I mean bank name from routing number.

Member Avatar
Member Avatar
+0 forum 1

Dear all, I have a scenario, where I have a single table with all my users listed in them. Each user also has a field indicating the user they report to. UserID UserDisplayName UserReportsTo ----------- ------------------------------------------------------------ ------------- 8 Anthony Karimi 3 9 naheed kassam 8 1 Administrator 1 3 Ramakrishna 2 2 SB 2 (5 row(s) affected) In my scenario, i need when the user selected is say userid = 3, then the table displays userid = 3; userid = 8 who reports to userid = 3; and userid = 9 who reports to userid = 8 as shown below …

Member Avatar
Member Avatar
+0 forum 4

I am trying to get the position of students in an exam. The SQL query I wrote uses the DENSE_RANK() function and it works properly just that it does not leave spaces after equal positions. I understand I can achieve that using the RANK() function. I Tried using the RANK() function but to my surprise, I am getting a position which is even greater than the students roll. I don't know what I am doing wrong in the second query which uses the RANK() function. What I want to achieve now is to be able to rewrite my query properly …

Member Avatar
Member Avatar
+0 forum 1

**problem** How to get cost per hotel and flight then add it in duration cost table based on flight date automatically . **Details** suppose i write flight date 26/07/2017 alexia 8days 04/08/2017 it must automatically get cost from hotel price table and price from flight then add it in duration cost table so that what query i write to get cost per hotel and flight when write flight date then insert it to duration cost table my database CREATE TABLE program( ProgramID int primary key not null, ProgramName varchar(30) ) GO insert into program values(1,'Alexia'),(2,'Amon'),(3,'Sfinx') GO CREATE TABLE ProgramDuration( DurationNo …

Member Avatar
Member Avatar
+0 forum 1

I am using MS SQL and have logs that are in .mdf and .ldf format. It took us a while but we figured out how to get our new settings correct and coming in w3c format. The olf files are still .mdf and I need to know what I can do to open them and view them. I have no database experience and want to know if there is a program I can use to do so. I have tried MSDEtoText.vbs and were unsuccessful running the script. Any suggestions will be greatly appreciated.

Member Avatar
Member Avatar
+0 forum 3

Hi I am trying to populate textbox value based on releated textbox value like that of (Country and State) using dynamic row formate. I can able to populate a value for only first row, if i tried ti for second row its again overwrite the first row and also i am trying the hide some textbox based on the value. Can anyone please help to solve this issue. Note: I have attached screenshot for your reference. **Html** <button type="button" class="btn btn-info" id="delete">- Delete</button> <button type="button" class="btn btn-info" id="addmore">+ Add More</button> <div class="clear"></div><br> <table> <tr align="center"> <td><input class='check_all' type='checkbox' onclick="select_all()"/></td> <td>Line …

Member Avatar
Member Avatar
+0 forum 3

To all database genius out there, I hope you can help me with this error I encountered when importing excel file to SQL Server 2005. This is the error: [CODE]Executing (Error) Messages Error 0xc020901c: Data Flow Task 1: There was an error with output column "Description" (21) on output "Excel Source Output" (9). The column status returned was: "Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard) Error 0xc020902a: Data Flow Task 1: The "output column "Description" (21)" failed because truncation occurred, and the truncation row disposition …

Member Avatar
Member Avatar
+0 forum 14

I am trying to cast/ convert varchar to a numeric value. I have done this succesfuly when I eval the lower range, however I get an error when I do the upper range. this is my evaluation section that works. isnull(cast(measurmentdata.measvalue as numeric),0) < productinfo.lowerrange however when I try to test to see if it is above the upper range it throws an error isnull(cast(measurmentdata.measvalue as numeric),0) > productinfo.upperrange I have tried not between as well. while it does not return any errors it does not correctly test for > or < isnull(cast(measurmentdata.measvalue as numeric),0) not between productinfo.lowerrange and productinfo.upperrange

Member Avatar
Member Avatar
+0 forum 3

Good day, I having a problem where creating my setting table as condition below column User_id setting effective_date effective_end_date Row 1: 1 ABC 2017-03-01 2018-02-28 Row 2: 1 DEF 2018-03-01 2019-03-01 I wish to add a constraint to block if same user add in a setting with the effective_date or effective_end_date between existing setting. Is that posible? I had searching and trying for a few days now without succeed to archive what I trying to do. Please kindly guide me through this. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

Hi hope you can help me. I have studied a lot to make my website using php and mysql and I know how to insert data in a table from a form, how to select and display data on page etc. Lately I got involved with wordpress which is a great CMS. The only problem is so different and is driving me nuts, also because I find no help in the various tutorials online. I have some simple questions. 1)Can you tell me how to insert data into a tablepress table from a form (my site is about hotel booking)-2) …

Member Avatar
+0 forum 0

Hello, I built a website on my personal server and everything work fine. But when I uploaded it on the production server there is a problem with the database - the character encoding is wrong so the text is unreadable (users submit greek words). The collation of the tables is **utf8_general_ci** and I've included the **meta charset="utf-8"** on all the pages. I've tried including **header('Content-type: text/html; charset=UTF-8');** or **SET NAMES UTF-8** but they didn't do anything. What did I do wrong? Thanks for your time.

Member Avatar
Member Avatar
+0 forum 1

The issue I am having has to do with not being able to show different OrderDate for the same Unit Unit OrderDate ShipDate ReceiptDate Robot 20160101 20160102 20160103 Robot 20160102 20160103 20160104 Robot 20160103 20160104 20160105 What is happening instead is that it is showing the same OrderDate for all three records. Unit OrderDate ShipDate ReceiptDate Robot 20160101 20160102 20160103 Robot 20160101 20160103 20160104 Robot 20160101 20160104 20160105 select salesorder.unitid "Unit",max(salesorder.eventdate) "OrderDate",max(salesdelivery.eventdate) "ShipDate",max(salesreceipt.eventdate) "ReceiptDate" from (select eventdate,unitid from sales where event='ORDER' and eventdate>'2015-12-31' and eventdate<'2016-02-01') salesorder left outer join (select eventdate,unitid from sales where event='SHIP' and eventdate>'2015-12-31' and eventdate<'2016-02-01') salesdelivery …

Member Avatar
+0 forum 0

Not sure if this is the right place for this, if not, please remove. I'm an Admin for a very large SAP landscape which includes variety of DBs. I've been evaluating the Xandria product from syslink ([www.syslinkams.com](http://www.syslinkams.com)) and so far been very impressed. I was wondering if anyone had any good/bad expereince.

Member Avatar
+0 forum 0

Hello friends. Please help me to solve my problem. I am using sql server 2008. When I try to access it recieve the following error: "Cannot connect to localhost ". So my question is, how to repair sql server? Hopefully someone will be able to help me with this.

Member Avatar
Member Avatar
+0 forum 4

I am working on a table that will hold batch data. The table will have a BatchDate column as a DateTime type. I'm considering adding a column for BatchYear as an integer and BatchPeriod (which could be a week number, a month number or a quarter number) as an integer, even though both of these values can be derived from the BatchDate and using another column in the table. I'm considering doing this because I'm thinking it would be easier to work with queries where someone doesn't have to pull the date from the table first, compute the period they …

Member Avatar
Member Avatar
+0 forum 3

Hi I am trying to get count based on the select query using prepare. But i am unable to get the count. Please help to fix the issue. **PDO function** public function getDistictCountRows($filname,$tablen,$condition){ echo $sql = "select $filname FROM $this->db_name.$tablen where $condition" ; $query = $this->conn->prepare($sql); try { $query->execute(); }catch(PDOException $e) { die($e->getMessage()); } echo $row_count = $query->rowCount(); } **code** $Users = new Users($db); $query = $Users->getDistictRows('DISTINCT(SHUSER)','FQ64001','ORDER BY SHUSER ASC'); $i=1; while($row_stream = $query->fetch(PDO::FETCH_ASSOC)) { extract($row_stream); $SHUSER1 = trim($SHUSER); $c1 = "SHUSER='$SHUSER1' and SHYQ64YN = 'Y'"; $active_count = $Users->getDistictCountRows('*','FQ64001',$c1);

Member Avatar
Member Avatar
+0 forum 4

currently I have a survey with 10 questions on a html/ php form. I use post data and then have a long insert statment. My code looks something like this. <php? $surveyid = $_POST['surveyid']; $q1 = $_POST['q1']; $q1comments = $_POST['q1comments']; $q2 = $_POST['q2']; $q2comments = $_POST['q2comments']; $q3 = $_POST['q3']; $q3comments = $_POST['q3comments']; $query "insert into survey(surveyid,q1,q1comments,q2,q2comments,q3,q3comments) $parms1 = array($surveyid,$q1,$q1comments,$q2,$q2comments .. $results = sqlsrv_query($conn,$query,$parms1); I'm trying to use a for loop but I can't quite get it right; foreach (question as $question ) { $query = "INSERT INTO safteyudit(auditid,questions,comment,issue) VALUES('$auditid','$question','$comments') "; $parms1 = array($auditid,$question,$comments,$issue); $query = sqlsrv_query($conn,$query,$parms1); }

Member Avatar
Member Avatar
+0 forum 13

I have a query that get the balance for last month and current month balance. I'm using a function inside the view that took more than 30 minutes. May I ask your help guys any idea or approach to speed up the processing or optimize the script it can be done in CTE. thank you. below is a sample data and actual result. select t.po_month /*** identity the next month date ***/ ,SUBSTRING(CAST(CONVERT(date,DATEADD(month,1,CONVERT(datetime,SUBSTRING(t.po_month,1,4)+SUBSTRING(t.po_month,6,2)+'01'))) AS VARCHAR),1,7) AS next_month ,t.item /** how can i achive this part in cte ****/ ,CASE WHEN OEM_Need - (OnHand_R + OnHand_RB + OnHand_S + OnHand_OEM+ OnOrder_RG …

Member Avatar
Member Avatar
+0 forum 3

Hiii I want to use select in select clause this is my statement which got an error: [code=sql]Select count(*) as cnt, (select count (answer_q1) from answers where (answer_q1 = 'ضعيف'))as a_q1 FROM Answers[/code] and this is the error: Error in SELECT clause: expression near 'SELECT'. Error in SELECT clause: expression near 'FROM'. Missing FROM clause. Unable to parse query text. DO YOU ANY OTHER WAY TO WRITE THE STATEMENT AND GET SAME RESULT?????? hELP ME PLEASE

Member Avatar
Member Avatar
+0 forum 7

The End.