Query Syntax

54K

Solutions

20K

Contributors

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.

Share tech news, updates, or what's on your mind.

Sign up to Post

select AVG(cast(mv AS float))  from mlbscores where el='cal'  AND LEAGE='nhl'

select AVG(cast(ml AS float))  from mlbscores where ev='cal'  AND LEAGE='nhl'

Hi you experts how to merge this 2 results in just one
regards
0
Starting with Angular 5
LVL 13
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Hello Experts,

I need Regex function in Oracle PL/SQL to check for Decimal Number(with or without decimal points) and Date(MM/DD/YYYYY), so I can validate the Parameter values in the pkg.

Below I found for Number(having greater than 0)
SELECT 'Number' FROM DUAL
WHERE regexp_like('111111111111111111110','^[0-9]+$')
AND NOT regexp_like('11111111111111111111','^0+$');

Open in new window


Thanks,
ASPDEV
0
I try to make the HTTP connection Http access to SSAS (MS Analysis Services) server over my IIS server

*i used guide https://docs.microsoft.com/en-us/sql/analysis-services/instances/configure-http-access-to-analysis-services-on-iis-8-0

When I try to make the connection from Microsoft SQL server Managment Studio over conn string: http://localhost/olap/msmdpump.dll

error raised: The remote server returned an error (405) Method Not Allowed. (System) i didnt find a solution
how to solve this problem?
0
Hi:
 I have spent days trolling forums and knowledge bases and you guys are my final try at getting an answer:

Does anyone have any idea how to pull the currentuserid when you are scripting inside on screen attribute forms inside of OpenText ECM Content Server?

In my content server volume I have created a custom attribute which using the sql that I wrote shown below will pull a specific list of values in the dropdown based off of the current username. When I type in/hard code a username (dhc) into the sql code the dropdown works and shows only the items from DocumentInfo_DocType that that user should see. When I try to make it look up who the current user is that is logged in the code fails. How do I change my sql code inside the opentext attribute form page to make it to look up who the current user is? I tried a bunch of things that I found on the web but nothing works ☹

picture of the  form screen is attached just in case that helps to see what screen I am on in my ECM opentext

Declare @MyDepartment as VARCHAR(100)
Set @MyDepartment=(Select b.Name
from KUAF a, KUAF b
where a.GroupID=b.ID and a.name = 'dhc')
Select Document_Type
from DocumentInfo_DocType
where Department like CONCAT('%', @MyDepartment, '%')
0
I would like to get the most recent datetime row from the table, for each unique object in column1. Can you help me build the query?
ID  |  DateTime
----------------------
1    | 10/17/19 10:24:15
1    | 10/17/19 11:15:56
2    | 10/16/19  07:45:34
2    | 10/17/19  01:01:24
0
Hello,

Using SQL Server 2012.

I have an xml held by a variable called Variables.  How can i empty every node?  i.e. set it to nil or clear it.

declare @Variables xml = 
'<Variables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <UserId>1</UserId>
  <UserFirstName xsi:nil="true" ></UserFirstName>
  <UserLastName>Administratör</UserLastName>
  <UserHSAIdentity xsi:nil="true" ></UserHSAIdentity>
  <UserUserId>2Admin</UserUserId>
  <UserEmailAddress1>xx@Skane.se</UserEmailAddress1>
  <UserEmailAddress2 xsi:nil="true" ></UserEmailAddress2>
  <UserAdressRad1>e</UserAdressRad1>
  <UserAdressRad2 xsi:nil="true" ></UserAdressRad2>
  <UserAdressRad3 xsi:nil="true" ></UserAdressRad3>
  <UserPostKod xsi:nil="true" ></UserPostKod>
  <UserPostStad xsi:nil="true" ></UserPostStad>
  <UserTelefon1>12344 129877</UserTelefon1>
  <UserTelefon2 xsi:nil="true" ></UserTelefon2>
  <UserStatus>Inaktiv</UserStatus>
  <UserJobCategory>Övrigt</UserJobCategory>
  <UserChangePasswordDateTime>Aldrig ändrat</UserChangePasswordDateTime>
  <UserLoginTries>0</UserLoginTries>
  <UserLockedDateTime>2018-02-09 14:23</UserLockedDateTime>
  <UserIsGDPRApproved>Nej</UserIsGDPRApproved>
  <UserGDPRApprovalDateTime xsi:nil="true" ></UserGDPRApprovalDateTime>
</Variables>'

Open in new window

0
I have a hyper-V server running 2012 R2.  20 cores and 256 gigs RAM.  On the host is a VM (server 2016) with 8 cores and 64 gigs RAM statically assigned.  That server runs an SQL 2016 application for route automation.  The VM is five days old, just built, prepped and put into production.

There seems to be a memory problem.

Every day since install, the RAM works it's way up to 97% and the server becomes non-responsive.

Task Manager, Resource Monitor and RAM Map DO NOT show any process using this RAM.

I repeat, the process using the RAM does not show in task manager, resource monitor or RAM Map.

I'm having the dickens finding out what is eating up the RAM and need someone to make some suggestions that might help me zero in on this.

I've thought about the 2012 R2 host and the 2016 VM and maybe its a hyper-visor issue, so, anyone know any issues with 2016 running in a VM on 2012 R2?

Anyone have any software they know of that might show me where the RAM is allocated that is not showing in the programs mentioned above that I'm using?  Something other than RAM Map maybe?

Anyway, that's the ghost I'm chasing.

Thank you for any feedback you might have.
0
we have migrated our SSIS packages from 2014 to 2016 in SSDT 2017.  I have a data flow task with odedb source connecting to a sql server DB with the below query. the package is running fine with no errors but no data is gettting populated
but if i run this in management studio its giving me 150 rows. Strange thing is if i remove the paramter conditions, its workign fine in SSIS but then IF i hardcode the dates its not populating any data again

do i need to refresh parameters or variables since we did the migration ? can anyone suggest what is causing this issue ?

Many Thanks


select * from vPBTF_Daily_Cash
where Round(Amount,2) <> 0
and Currency = 'GBP'
and (USERDATE = ? or (CD = ? and USERDATE < ?))

The above query is using a datetime variable with expresson (DT_DATE)(DT_DBDATE)GETDATE(). This will basically give todays date . for example 17/10/2019
0
How to identify slow running queries in SQL Server and how to resolved it
0
how can I check last 30 or 60 days database active connection history in sql server ? I need to decommission sql server.
0
CompTIA Cloud+
LVL 13
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Hi,
Question: I wanted to host my web application developed in React.js and asp.net core 2.2 WebAPI with unlimited SQL Server 2012 (or higher) databases support. Which shared hosting plan best suites this requirement?
Please help
0
HI Team,

I need your help to solve the below problem  in sql server.

i have a table data in one format and i want to display it in another format. (SQL Server)

SSNID      SSNSoftwareSerialNumber     SSNPAFDQuantity      ProductAttributeFeatureName
100931          NV5100620199743                                 25                                                 Tier1
100931          NV5100620199743                                  0                                                 Tier2
100931          NV5100620199743                                  0                                                 Tier3
100931          NV5100620199743                                  3                                                 Tier4
100932          ESS100820196024                                  0                                                 Tier1
100932          ESS100820196024                                  0                                                 Tier2
100932          ESS100820196024                               1000                                         Tier3
100932         ESS100820196024                                  0                                                 Tier4

I want to show it in the below format.

SSNID      SSNSoftwareSerialNumber           Tier1             Tier2       Tier3      Tier4
100931            NV5100620199743                      25                0                0                3
100932            ESS100820196024                              0               0            1000              0

Please find the attached screen shot (1 and 2) for more details.
Pivot-Table.PNG
Pivot-Table_with-explanation.PNG
0
Cannot see one database in the linked server. I have three servers. Server A is running SQL 2014. Servers B and C are running SQL 2017. I have created a linked server on server B and C back to server A. When I review the catalogs under the linked server on servers B and C all but one of the databases is there. The ones that are there all have the same names. If I create a database on server B and C with the same name, the database will appear but there are no tables. What must I do to be able to see all the databases on server A from within SQL on servers B and C? I am logged into all servers as 'sa'. I have set RPC and RPC Out to True on both servers B and C.
0
Hi,

I'd need to upgrade some software on a vm, the software uses backend SQL.
I can take a snapshot of the vm, but how do I backup (restore?) the SQL (2008)  in a quick & simple way?

J.
0
Hi

I have a SQL Server table with a varbinary-field in it. I want to insert that record in a MySQL-Database. How can I access this field-data?
myTable is local on a SQL Server
mySqlTable1 is on a MySQL Server in the web

Query1.SQL.Text := 'SELECT myString1, myVarBinary1 FROM myTable';
Query1.Execute;
mySqlQuery1.SQL.Text := 'INSERT INTO mySqlTable1 (str1, blob1) VALUES('+QuotedStr(Query1.FieldByName('myString1').AsString)+','+??myVarBinary1??)'

Open in new window

How can I access the varbinary-field? Something like Query1.FieldByName('myVarBinary1').As???
Thanks for any help
Peter
0
Need assistance with sql statement to return the full date to just the Jan 2019, etc.

I need to return a count of ServiceID per SubIssued, for each MonthYear.

Please modify the following query to return the correct results:

 Code:

select       [VSTS_Common_ProjectSubIssue] as 'ProjectSubIssue'
    , Count([System_ID]) AS MTHLYCT
      , VSTS_Common_ResolvedDate
      , CONVERT(VARCHAR(2),MONTH(VSTS_Common_ResolvedDate)) + CONVERT(VARCHAR(4),YEAR(VSTS_Common_ResolvedDate) AS ResolvedDate  
--, REPLACE(RIGHT(CONVERT(VARCHAR(9), VSTS_Common_ResolvedDate(), 6), 6), ' ', '') AS [MMYY]
FROM [qry1].[view1] TFS
where VSTS_Common_ProjectSubIssue
      in
      (
            'China Special Handling Request'
            , 'Empty Box Received'
            , 'Incorrect Product Received'
            , 'Lost in Transit'
            , 'Replacement SN Verification Request'
            , 'Tamper/Damage Bypass Request'
            , 'Tamper/Damaged Product Received'
            , 'Wrong Item Received'
            , 'SN Dosent Match Ticket'
      )
and
[VSTS_Common_InputPath] = 'Service Center'
and System_State in ('Closed', 'Resolved')
and VSTS_Common_ResolvedDate >= '07/01/2019'  
group by VSTS_Common_ProjectSubIssue, VSTS_Common_ResolvedDate
--, Count([System_ID])
--, CONVERT(VARCHAR(2),MONTH(TransactionDte)) + '/' + CONVERT(VARCHAR(4),YEAR(TransactionDte)
0
I'm using an ssis pkg to load data from Oracle 12.2.0.1.0 (we just upgraded) into Sql Server 2014.  It worked fine before upgrade, now I'm getting buffer and memory errors.  

Any suggestions?

Connection manager - Native OLE\DB Oracle provider for OLE DB

using a dataflow
0
Priority Boost feature on SQL server

As per the Microsoft recommendation, the feature will be deprecated in future versions and
recommended to not use this feature in new development work and modify applications that currently
use this feature as soon as possible.

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-priority-boost-server-configuration-option?view=sql-server-ver15


Do we also need to disable it on existing critical servers where implemented as best practice?

Thanks
0
A have a telerik rad grid that is not displaying all the records in the recordset provided to it.  The radgrid's datasource is a SQLDataSource. When if I run the sql statement in SSMS, I see all records.

Another isuue I have is have to debug the sqldatasource in Visual Studio.

Any thoughts?
0
Exploring SharePoint 2016
LVL 13
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Hello:

In SQL Reporting Services (SSRS), the main report containing data from two subreports is displaying data accurately.

But, I'm curious as to why the data displayed upon generating the subreports "by themselves" is being pulled one day behind the data displayed on the main report.

Again, the data in the main report and pulled from the subreports is showing as accurate.  But, the subreports "by themselves" are one day behind.

What are some things to check, to determine why the timing in the main report is correct as compared to the subreports?

Thanks!

John
0
I have large table in access and I want to split it into smaller tables based on unique value in field one. Does anyone know of a query?

Thank you.
0
I want to know if it's a good idea to have database views be used for queries and reporting instead of the live database tables?  This database has 100's of tables, but I know that for their reporting, they will probably only need 5 or 6.  Thoughts?  Any body have any recommendations, suggestions for creating database table views?
0
I have a virtualized windows 2012 server running SQL 2014. I am using Veeam to back it up. I keep getting a warning message:

"SQL VSS Writer is missing: databases will be backed up in crash-consistent state"

When I check my services I do not see this service. How can I get this installed?
0
I've got two RDS installations, one with 2012 R2 and the other with 2016. I'm setting up a test environment so I can understand how to do a cluster of RDS Connection Brokers.

I setup two servers and installed the 2012 SQL native client (there isn't a 2016 native client).on each CB. I verified the cluster is working by taking one server down at a time and the cluster IP remains pingable..

In the setup wizard for RD Connection Broker for HA, it asks for the DNS of the RD Connection Broker cluster, so I put that in.

But there is no RD CB service for the cluster, just on each CB server, so the wizard fails.

I found this video (https://www.youtube.com/watch?v=kQufizuFTkk), but it is for 2008 R2. It appears I need to create the services for the cluster?

My DNS zone broker.mydomain.com points to the IP of the cluster.

Not sure what the next steps are so the HA wizard will complete successfully.
0
I am struggling with PowerBI and I need to show that data in a certain way.

I have the data set with a Days Completed, and I want to show the number of tickets completed in 0 days, 1 days, and 3 days for the last three months.

The data goes back almost a year and I cannot figure out how to do it
DATA-Annotation-2019-10-11-095147.png
InkedAnnotation-2019-10-11-095147_LI.jpg
TablesAnnotation-2019-10-11-100441.png
0

Query Syntax

54K

Solutions

20K

Contributors

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.