|
<pre lang="vb">DECLARE @CheckQuantity INT
SET @ParmDefinition = N'@CheckQuantity INT'
SET @SQL = N'
SET @CheckQuantity= 12'
PRINT @SQL
EXEC [dbo].sp_executesql @SQL, @ParmDefinition,
@CheckQuantity=@CheckQuantity;
PRINT @CheckQuantity</pre>
It Should Print 12 but the output is NULL , Please tell me How to SET VALUE For the VAriable declare outside the SQL Text cretaed for dynamic query
|
|
|
|
|
any one who has solution for this
|
|
|
|
|
You need to make the parameter an OUTPUT parameter.
https://support.microsoft.com/kb/262499[^]
DECLARE @CheckQuantity INT;
SET @ParmDefinition N'@CheckQuantity INT OUTPUT';
SET @SQL = N'SET @CheckQuantity= 12';
PRINT @SQL;
EXEC [dbo].sp_executesql @SQL, @ParmDefinition, @CheckQuantity = @CheckQuantity OUTPUT;
PRINT @CheckQuantity;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you friend it's working now
|
|
|
|
|
Hi Team,
We have an application called as TMART. Basically TMART is used to monitor each application such as web,citrix etc.
Under a particular project we have multiple monitor that are getting monitored.
We would like to have a sql query through which we can pull the availability error.
Can some one please provide us with the sql query for the same.
Its bit urgent...
Your response would be highly appreciated.
|
|
|
|
|
It is impossible to give you an answer without details of the tables and columns involved, so please give us the information needed to help you.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Hi Chris,
I am really happy for the quick response.
But there is no table and columns involved into this.
We have the data as below:-
(Complete Time of the Period – (Addition of Failures Durations)) / (N° of Failures + 1)*
*for n failures, there n + 1 periods of functioning, and therefore:
For example for a month as January with 44 640 seconds for the complete period and errors as below:
• From 1/1/14 09:17 to 1/1/14 17:20, (error 1 duration = 483 minutes)
• From 14/1/14 17:20 to 15/1/14 07:40 (error 2 duration = 860 minutes)
• From 21/1/14 07:40 to 21/1/14 11:12 (error 3 duration = 212 minutes)
The MTBF would be:
(44 640 - (483 + 860 + 212)) / 4 = 5 385 minutes 30s, MTBF is 89 hours 45mn 30s = 3 days 17 hours 45mn 30s.
This is what we require for... 
|
|
|
|
|
If there are not tables or columns, mhow can you expect a SQL query to work?
How is the data held, where is the data held?
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Don't tell me it is a text report and you are hoping to query the text file using TSQL - not going to work.
First you need to parse the data into logical fields using the correct data types. Then you may query the TABLE and COLUMNs to get the results you need.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
my query like this
cte3_persen (per) as
(select ((cte1.totalcount/cte2.TotaCount)* 100 )
from cte1,cte2)
i am creating one new cte table shown above
from that value '2'coming from cte1.totalcount and value '500' coming from cte2.TotaCount
i want percentage of those value it should be in 0.00% format
i want ans of per from cte3_persen table is =0.40%
please help some one
|
|
|
|
|
What are your data types for the TotalCount variables? are they of Decimal type?
if so then have a look at this
DECLARE @value1 DECIMAL(18,2)
DECLARE @value2 DECIMAL(18,2)
SET @value1 = 2
SET @value2 = 500
SELECT (@value1 / @value2)*100
SELECT CAST((@value1 / @value2)*100 AS DECIMAL(18,2))
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
is that the same for TotalCount from the second CTE?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Sounds like you want to round your result to 2 decimal places before dividing by 100
SELECT
(2/500)* 100 AS not_rounded,
(round(2/500,2))* 100 AS rounded
from dual;
returns
NOT_ROUNDED ROUNDED
----------- -------
0.4 0
Regrads
|
|
|
|
|
Which is the best database to manipulate 100 million records which configures with c# win. form.
|
|
|
|
|
All the known databases - SQL or NoSQL - can easily handle a 100 million records. All of them has also binding to .NET (so to C#)...
You may map your request on that data, store only, OLAP, more read than write...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
actually i am already working on sql but i am not sure that it can manage 100 million record. somebody suggested me oracle is oracle better than SQL.
|
|
|
|
|
I've worked with SQL had table with over 800 million rows - so no problem. The main factor is the usage. You have to find a good PK and as less as possible other indexes and FKs...
However if you aim to even higher you may look for some big-data database...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I have worked with 300 million rows in an Oracle database and yes it handles them well however... so will a SQL Server database.
What matters is how the indexes and partitions are set up on tables, as access to tables with this number of rows will be considerably affected by these decisions.
With 100+ million rows you are most likely going to need to partition tables.
[edit]grammar correction[/edit]
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 11-Feb-14 13:24pm.
|
|
|
|
|
GuyThiebaut wrote: partition tables
That could be a good idea, especially if you have much to read - however it can work without...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Oracle because it has more security than SQL.
|
|
|
|
|
I'm not familiar with Oracle. Would you care to expand on that statement? What security features does Oracle provide that are missing from MS SQL?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
What's funny but totally expected is that both Oracle and Microsoft claim that their database has the better security.
I'm of the opinion that the safer product is the one with the better DBA.
And since SQLServer is easier to run out of the box...
|
|
|
|
|
Really? Can you elaborate on that?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Agent_Spock wrote: i am not sure that it can manage 100 million record
According to the Microsoft document "Maximum Capacity Specifications for SQL Server":
Rows per table: Limited by available storage
Database size: 524,272 terabytes
So unless each of your rows is going to exceed 5.36 gigabytes, you should be fine.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|