Time To Execute A Query?

Aug 1, 2003

Is there a way in sql server to find out how much time a sql server took to execute a query.

Thanx in advance.

Regards,

Samir

View 2 Replies


ADVERTISEMENT

Query Takes Longer To Execute The Second Time

Feb 13, 2001

Has anybody come across situations where queries take longer to execute the second time? The server is a dedicated sql server box with 1gb memory.

Thanks in advance.
Praveena

View 2 Replies View Related

Why My Query Is Slow When I Execute Full Text Search Service For Firts Time

Dec 18, 2007

first sorry my english,

when i execute a query for the first time whith full text service from visual studio, show me the error 'server not responding' and when i execute this query for second time works perfectly.

View 1 Replies View Related

Help! The Transaction Log Is Full Error In SSIS Execute SQL Task When I Execute A DELETE SQL Query

Dec 6, 2006

Dear all:

I had got the below error when I execute a DELETE SQL query in SSIS Execute SQL Task :

Error: 0xC002F210 at DelAFKO, Execute SQL Task: Executing the query "DELETE FROM [CQMS_SAP].[dbo].[AFKO]" failed with the following error: "The transaction log for database 'CQMS_SAP' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


But my disk has large as more than 6 GB space, and I query the log_reuse_wait_desc column in sys.databases which return value as "NOTHING".

So this confused me, any one has any experience on this?

Many thanks,

Tomorrow

View 5 Replies View Related

Time To Execute?

Dec 27, 2006

Is there a built-in method or function that can display how long a report took to execute? (Soup to nuts...issuing of the SQL/MDX statement, through all pages being rendered)



Thanks!



View 1 Replies View Related

First Time User. How Do I Execute SQL Like @ In Oracle

Mar 26, 2001

In order to execute sql in Oracle, I use @sample.sql.

In SQL server, how can I execute it?

View 3 Replies View Related

Command Execute Fails The Second Time It Is Invoked

Jan 15, 2008



Hello, the following code works perfectly in SQL Server 2000 and SQL Server 2005 Express over WinXP but when run against an instance of SL Server2005 Express over Win2003Server, the first time Command.Execute is invoked returns no error (even though no action seems to be take by the server), subsequent calls return the error -2147217900 couldn't find prepared instruction with identifer -1 (message may vary, it is a translation from may locale)

Any ideas?
Thanks



Code Block
Public Sub Insert_Alarm(sIP As String, nAlarm As Long)
Static cmdInsert As ADODB.Command
Static Initialized As Boolean
On Error GoTo ErrorHndl
If Not Initialized Then
Set cmdInsert = New ADODB.Command
Set cmdInsert.ActiveConnection = db
cmdInsert.Parameters.Append cmdInsert.CreateParameter("IP", adVarChar, adParamInput, Len(sIP), sIP)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("Alarm", adInteger, adParamInput, , nAlarm)
cmdInsert.CommandText = "insert into ALARMS(date_time,ip,alarm,status) values (getdate(),?,?,1)"
cmdInsert.CommandType = adCmdText
cmdInsert.Prepared = True
Initialized = True
End If
cmdInsert.Parameters(0).value = sIP
cmdInsert.Parameters(1).value = nAlarm
cmdInsert.Execute
Exit Sub
ErrorHndl:
...
End Sub

View 4 Replies View Related

Transact SQL :: Converting 24hrs Time To 12 Hours Time Query Format?

Apr 21, 2015

SELECT 
    CONVERT(VARCHAR(10),attnc_chkin_dt,101) as INDATE,
    CONVERT(VARCHAR(10),attnc_chkin_dt,108) as TimePart
FROM pmt_attendance

o/p
indate   04/18/2015
time part :17:45:00

I need to convert this 17:45:00 to 12 hours date format...

View 8 Replies View Related

Help Writing Query (find The Entry With The Closest Time Given A Time)

May 26, 2005

Hi,

I have a table which has a few fields, one being "datetime_traded". I need to write a query which returns the row which has the closest time (down to second) given a date/time. I'm using MS SQL.

Here's what I have so far:


Code:


select * from TICK_D
where datetime_traded = (select min( abs(datediff(second,datetime_traded , Convert(datetime,'2005-05-30:09:31:09')) ) ) from TICK_D)



But I get an error - "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.".

Does anyone know how i could do this? Thanks a lot for any help!

View 2 Replies View Related

Help On Execute Proces Task --posting Secoind Time

Feb 20, 2008



Hi,

I have a batch file which is located in different server. When I try to execute in BIDS it is running fine. But when I execute as SQL agent job it is not executing.

In the execute process task under executable I have supplied the batch file path . For example \112.89.93.9abcsample.bat.

It is executing fine when I execute this in BIDS supplying the above path under executable. But when I run this as SQL agent job it keeps on running and does not end and it is doing anything.

Do I need to mention any cmd.exe file under executable and give the path under arguments tab?

Any help is appreciated.

Thanks




View 10 Replies View Related

Run Time Error While Execute Sql Server 2005 Integration Services Package From C#

Jun 6, 2006

Hi

I am trying to Execute an SSIS Package from C# Dot Net.

Below the code i am using.

try
{
Application app = new Application();
Package package = app.LoadPackage("DTSPackage/WinServeMonitoring.dtsx", null);
DTSExecResult result = package.Execute();
label1.Text = "Package Execution " + result.ToString();


}
catch (Exception exp)
{
label1.Text = exp.Message.ToString();
}

I have added reffrence for DTS Run time (using Microsoft.SqlServer.Dts.Runtime;)

But I am getting an Error like this

Error 1 'Application' is an ambiguous reference between 'System.Windows.Forms.Application' and 'Microsoft.SqlServer.Dts.Runtime.Application' C:Documents and Settingsvahqmd10My DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1Form1.cs 23 17 WindowsApplication1


Error 2 'Application' is an ambiguous reference between 'System.Windows.Forms.Application' and 'Microsoft.SqlServer.Dts.Runtime.Application' C:Documents and Settingsvahqmd10My DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1Form1.cs 23 39 WindowsApplication1


Error 3 The type 'System.Windows.Forms.Application' has no constructors defined C:Documents and Settingsvahqmd10My DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1Form1.cs 23 35 WindowsApplication1

Can any one Help me !

Regards

Deepu M.I

View 9 Replies View Related

Query Takes Too Much Time At The Time Of Execuion

May 15, 2008

Hello All,

Below carry takes too much time while execution


Select
'PIT_ID' = CASE WHEN Best_BID_DATA.PIT_ID IS NOT NULL THEN Best_BID_DATA.PIT_ID ELSE Best_OFFER_DATA.PIT_ID END,
Best_Bid_Data.Bid_Customer,
Best_Bid_Data.Bid_Size,
Best_Bid_Data.Bid_Price,
Best_Bid_Data.Bid_Order_Id,
Best_Bid_Data.Bid_Order_Version,
Best_Bid_Data.Bid_ProductId,
Best_Bid_Data.Bid_TraderId,
Best_Bid_Data.Bid_BrokerId,
Best_Bid_Data.Bid_Reference,
Best_Bid_Data.Bid_Indicative,
Best_Bid_Data.Bid_Park,
Best_Offer_Data.Offer_Customer,
Best_Offer_Data.Offer_Size,
Best_Offer_Data.Offer_Price,
Best_Offer_Data.Offer_Order_Id,
Best_Offer_Data.Offer_Order_Version,
Best_Offer_Data.Offer_ProductId,
Best_Offer_Data.Offer_TraderId,
Best_Offer_Data.Offer_BrokerId,
Best_Offer_Data.Offer_Reference,
Best_Offer_Data.Offer_Indicative,
Best_Offer_Data.Offer_Park

from
(
Select PITID PIT_ID, CustomerId Bid_Customer, Size Bid_Size, Price Bid_Price, orderid Bid_Order_Id, Version Bid_Order_Version,
ProductId Bid_ProductId, TraderId Bid_TraderId, BrokerId Bid_BrokerId,
Reference Bid_Reference, Indicative Bid_Indicative, Park Bid_Park
From OrderTable C
Where
version = (select max(version) from OrderTable where orderid = c.orderid)
and BuySell = 'B'
and Status <> 'D'
and Park <> 1
and PitId in (select distinct pitid from MarketViewDef Where MktViewId = 4)
and Price =
( Select max(Price) From OrderTable cc
where version = (select max(version) from OrderTable where orderid = cc.orderid)
and PitId = c.PitId
and BuySell = 'B'
and Status <> 'D'
and Park <> 1
)
and Orderdate =
( Select min(Orderdate) From OrderTable dd
where version = (select max(version) from OrderTable where orderid = dd.orderid)
and PitId = c.PitId
and BuySell = 'B'
and Status <> 'D'
and Price = c.Price
and Park <> 1
)
and OrderId = (select top 1 OrderId from OrderTable ff
Where version = (select max(version) from OrderTable where orderid = ff.orderid)
and orderid = ff.orderid
and PitId = c.PitId
and BuySell = 'B'
and Status <> 'D'
and Price = c.Price
and Orderdate = c.Orderdate
and Park <> 1
)

) Best_Bid_Data

full outer join
(
Select PITID PIT_ID, CustomerId Offer_Customer, Size Offer_Size, Price Offer_Price, orderid Offer_Order_Id, Version Offer_Order_Version,
ProductId Offer_ProductId, TraderId Offer_TraderId, BrokerId Offer_BrokerId,
Reference Offer_Reference, Indicative Offer_Indicative, Park Offer_Park
From OrderTable C
Where
version = (select max(version) from OrderTable where orderid = c.orderid)
and BuySell = 'S'
and Status <> 'D'
and Park <> 1
and PitId in (select distinct pitid from MarketViewDef Where MktViewId = 4)
and Price =
( Select min(Price) From OrderTable cc
where version = (select max(version) from OrderTable where orderid = cc.orderid)
and PitId = c.PitId
and BuySell = 'S'
and Status <> 'D'
and Park <> 1
)
and Orderdate =
( Select min(Orderdate) From OrderTable dd
where version = (select max(version) from OrderTable where orderid = dd.orderid)
and PitId = c.PitId
and BuySell = 'S'
and Status <> 'D'
and Price = c.Price
and Park <> 1
)
and OrderId = (select top 1 OrderId from OrderTable ff
Where version = (select max(version) from OrderTable where orderid = ff.orderid)
and orderid = ff.orderid
and PitId = c.PitId
and BuySell = 'S'
and Status <> 'D'
and Price = c.Price
and Orderdate = c.Orderdate
and Park <> 1
)

) Best_Offer_Data
ON Best_Bid_Data.Pit_Id = Best_Offer_Data.Pit_Id

Can any one please help me?

Thanks
Prashant

View 2 Replies View Related

Error Invalid Use Of Side-effecting Or Time-dependent Operator In 'EXECUTE STRING' Within A Function

May 8, 2008



Hi all, mister
I want create a function but I get this error: Error Invalid use of side-effecting or time-dependent operator in 'EXECUTE STRING' within a function

I think in a function, cannot use temp tables, or calling exec or store procedures.

Which is the best solution for my issue ? develop store procedure ??

thanks.

CREATE FUNCTION fnObtenerTablaMaestra ()

RETURNS @T Table ( Descripcion VARCHAR(20) NOT NULL, CIF VARCHAR(8) NULL )

AS

BEGIN

DECLARE @cmd nvarchar(max)

DECLARE @sql nvarchar(max)

DECLARE @nexoUNION NVARCHAR(max)

DECLARE @params nvarchar(max)

DECLARE @NombreTabla VARCHAR(MAX)

DECLARE @Descripcion VARCHAR(MAX)

DECLARE @CIF VARCHAR(MAX)

-- Cannot access temporary tables from within a function.

-- IF EXISTS (SELECT TABLE_NAME FROM tempdb.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '#tmpTable%')

-- DROP TABLE #tmpTable

-- CREATE TABLE #tmpTable ( Descripcion VARCHAR(20) NOT NULL, CIF VARCHAR(8) NULL )



SET @nexoUNION = NULL



DECLARE c1 CURSOR for

SELECT [CD_NOMBRE_TABLA], [DS_CAMPO_DESCRIPCION], [DS_CAMPO_CIF] FROM [TABLA_MAESTRA]



OPEN c1

FETCH c1 INTO @NombreTabla, @Descripcion, @CIF

--FETCH NEXT FROM c1 INTO @NombreTabla, @Descripcion, @CIF

WHILE @@FETCH_STATUS >= 0

--WHILE @@FETCH_STATUS = 0

BEGIN

SELECT @sql =

'INSERT INTO #tmpTable

N'''+ @NombreTabla + '''

N'''+ @Descripcion + '''

N'''+ @CIF + ''''



SELECT @sql =

'SELECT ' + @Descripcion + ', '+ @CIF + ' FROM ' + @NombreTabla

IF @nexoUNION IS NULL

BEGIN

SET @nexoUNION = 'UNION'

END

ELSE

SET @sql = @nexoUNION + ' ' + @sql



-- EXECUTE (@sql)

--Exec(@sql)

FETCH c1 INTO @NombreTabla, @Descripcion, @CIF

--FETCH NEXT FROM c1 INTO @NombreTabla, @Descripcion, @CIF



END

CLOSE c1

DEALLOCATE c1

--SET @sql = 'SELECT Descripcion, CIF FROM #tmpTable'

-- Error Invalid use of side-effecting or time-dependent operator in 'EXECUTE STRING' within a function

EXECUTE(@sql)

RETURN

END

GO

View 1 Replies View Related

The Merge Process Failed To Execute A Query Because The Query Timed Out

Dec 22, 2006

Hi there. I have occasional sincronization error.-XSUBSYSTEM Merge
-XSERVER MYSERVER
-XCMDLINE 0
-XCancelEventHandle 000006E0
2006-12-22 14:55:00.833 Connecting to Subscriber 'Subscriber01'
2006-12-22 14:55:00.895 Connecting to Distributor 'Publisher01'
2006-12-22 14:55:02.974 Initializing
2006-12-22 14:55:03.083 Connecting to Publisher 'Publisher01'
2006-12-22 14:55:06.005 Retrieving publication information
2006-12-22 14:55:06.130 Retrieving subscription information.
2006-12-22 15:00:07.222 The merge process failed to execute a query because the query timed out. If this failure continues, increase the query timeout for the process. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write.
2006-12-22 15:00:07.456 Error converting data type nvarchar to numeric.
2006-12-22 15:00:07.800 Category:SQLSERVER
Source: Subscriber01
Number: 8114
Message: Error converting data type nvarchar to numeric.

After manual syncronization it goes under control.

Could anybody explain the relationship between converting error and timed out query?

If this is poor connection's problem how can I increase the query timeout for the process?

View 5 Replies View Related

SSIS Hard Time Getting Back XML Return Data From Stored Procedure Call Executed By Execute SQL Task

Aug 9, 2006

I'm having a hard time to getting back an xml data back from a stored procedure executed by an Execute SQL task.

I'm passing in an XML data as a parameter and getting back resulting XML data as a parameter. The Execute SQL task is using ADO connection to do this job. The two parameters(in/out) are type of "string" and mapped as string.

When I execute the task, I get the following error message.

[Execute SQL Task] Error: Executing the query "dbo.PromissorPLEDataUpload" failed with the following error: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 ("@LogXML"): Data type 0xE7 has an invalid data length or metadata length.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

I also tried mapping the parameter as XML type, but that didn't work either.

If anyone knows what's going on or how to fix this problem please let me know. All I want to do is save returning XML data in the parameter to a local package variable.

Thanks

View 10 Replies View Related

Log The Query Of The Execute Query Task

Mar 23, 2007

Hi,

I want to log/watch the query executed by the "Execute query Task". It's a query with different variables, the different variables i can see in one of the debug windows and these looks OK, but the query doesn't do what's expected. So i want to see the whole query, is that possible?

Query logging on the database server isn't an option. The server is an oracle server and the dba doesn't want to change this setting.

Thanks,

Dennis

















View 3 Replies View Related

MDX Query Builder - Query Does Not Execute

Jan 3, 2008

NOTE: I am using Brian Larsons book Delivering Business Intelligence with SQL Server 2005. I am stuck on page 588 - step 20. I am using Windows Vista Ultimate

Once all the Dimensions & attributes I have selected are dragged into the query area in MDX query builder no data is displayed. There is a message: "No rows found. Click to execute the query." - clicking does nothing.

How can I resolve this problem ???

View 2 Replies View Related

I Need Some Help.... I Cannot Execute Any Query Fr

Jul 27, 2007

Hi all,

I need some help.... I cannot execute any query from sql 2005, when I try to execute a query it stays executing and I never receive any result set. I uninstalled and re installed again SQL 2005 in my computer and also I installed the Service Pack and I am still getting the same. Could you please help me or advice on this situation?

Thanks in advance,

Mauricio.

View 10 Replies View Related

Execute Query For Each Row

May 3, 2007

I want to execute a query for each row in a report since a parameter in that query relies on a field in the row. Is there a way to do this?

View 1 Replies View Related

How Can I Execute SQL Query From DOS With Parameters?

Feb 8, 2007

I believe all of us use SQL Server Management Studio to execute query. As I encountered serious problem with this method, due to typo error by accident, I am wondering if we can run the .sql file from dos and supply parameters with it.Possible?

View 4 Replies View Related

Execute A Query From A String

Jan 27, 2004

I've got a string that contains my Insert query

How can I execute it ?


declare @sql char(500)
Select @sql = '"Insert Into T74ACCO Select * From tempdb..##Temp tp Where tp.' + @Key + ' not In (Select ' + @Key + ' From T74ACCO)"'


Thank you in advance
BK,BM or Snail

View 14 Replies View Related

Execute Query With Buffer.

Feb 15, 2007

Ramesh writes "Hi,

Is there any possibility to execute a query in sql server 2000 without keep / using buffer.

Thanks"

View 1 Replies View Related

SQL Server - How To Execute New Query

Sep 5, 2006

I create some tables and I can't execute new query, I used to be able to do it, but I can't do it now. I'd like to find out that how can I do it again.

Thanks

View 3 Replies View Related

Trying To Execute An Update Query From A Button

Jun 16, 2006

I've got a sqldatasource with a update query in it.  Now I'm trying to execute that query on button click.  How do I go about doing so?
 
Here's my ASPX code:
 
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Data_Verification_Editor.aspx.vb" Inherits="Core_Data_Verification_Editor" %>
<!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 runat="server">
<title>Data Verification Editor</title>
</head>
<body>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDS_Valid" runat="server"
ConnectionString="<%$ ConnectionStrings:Test%>"
SelectCommand="Data_Validation_sp" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<asp:SqlDataSource ID="Test" runat="server"
ConnectionString="<%$ ConnectionStrings:Test%>"
UpdateCommand="UPDATE [Data_Valid_Current_tbl] SET ID = '@selected_id', SET Title = '@selected_text' WHERE PrimID = '1'">
<UpdateParameters>
<asp:ControlParameter Name="selected_id" ControlID="Data_Ver_ddl" PropertyName="SelectedValue" />
<asp:ControlParameter Name="selected_text" ControlID="Data_Ver_ddl" PropertyName="SelectedText" />
</UpdateParameters>
</asp:SqlDataSource>
<table style="width: 320px; background-color: menu; border-right: menu thin ridge; border-top: menu thin ridge; border-left: menu thin ridge; border-bottom: menu thin ridge; left: 3px; position: absolute; top: 3px;">
<tr>
<td colspan="2" style="font-family: Tahoma; font-size: 10pt;">
Testing:<br />
</td>
</tr>
<tr>
<td colspan="2">
<asp:DropDownList ID="Data_Ver_ddl" runat="server" DataSourceID="SqlDS_Valid" DataTextField="Title"
DataValueField="ID" style="width: 100%; height: 24px; background: gold">
</asp:DropDownList>
</td>
</tr>
<tr>
<td style="width:50%">
<asp:Button ID="Submit_btn" runat="server" Text="Submit" Font-Bold="True"
Font-Size="8pt" Width="100%" />
</td>
<td style="width:50%">
<asp:Button ID="Done_btn" runat="server" Text="Done" Font-Bold="True"
Font-Size="8pt" Width="100%" />
</td>
</tr>
</table>
</form>
</body>
</html>
 

View 1 Replies View Related

Query Analyser Execute Sequence

Jan 4, 2001

Howdy

If I have serveral queries as shown below:
================================================== ==========
USE XXX
SELECT XX_ZZZZZ, XX_YYY, XX_XXX
FROM ZZZ_ZZZZ_ZZZZ
WHERE QQQQQQQQQQQQQ ='PGL'

USE XXX
SELECT AAA_AAAAA_AAAA,AA_BBB, CC_DDD
FROM SSSS_SSSSS_SSSSS
WHERE FFF_FFFF ='A'
================================================== ===========
Can anyone tell me if the queries execute concurrently or
is it one after the other?

Many thanks,

W.

View 1 Replies View Related

Execute A Query Without Fireing Triggers - How?

Jun 17, 2006

Hello,

I would like to execute a sql-query on a table, but disable the triggers that whould fire on the change.

Thank you for telling me how to do this!

Regards,
Fabian

my favorit hoster is ASPnix : www.aspnix.com !

View 2 Replies View Related

Execute Query Within Custom Code

Apr 2, 2008

Hi,
Is it possible to connect to a database and fetch data from it from within custom code inside a report?
Appreciate any help.

Regards,
Asim.

View 4 Replies View Related

SP2 Issue With Execute SQL Parametrized Query

Feb 21, 2007

Hello,

I try SP2 and cannot get the Execute SQL task to work as before.

In this example I use an OLEDB Microsoft Oracle provider.

The script uses a parameter like that

 select Cast( decode((
select
DECODE(TRUNC(c.END_DATE), TRUNC(SYSDATE),1,NULL) AS RESULT
from one_stage.load_complete c
where TRUNC(c.end_date) = TRUNC(sysdate)
and c.name = ?
and c.STATUS = 'SUCCEEDED')
,Null,0,1)  as varchar(2)) AS Result from Dual

The script task is set to BypassPrepare = False

I note only one change, the addition of a parameter setting called Parameter Size set by default to -1

I tried different things like reading the new BOL, changing the Bypass prepare, Changing the Parameter Size and changing the ? , nothing works. the output variable is always set to a value of 0 which is the result of the query test if there is no match.

It looks like the input variable is no longer passed to the query parameter.

What should I do to get this to work with SP2?

Thanks

Philippe

View 14 Replies View Related

How To Convert UTC Time (retrieved From SQL) To Local Time In Reporting Services Based On Time Zone

Aug 7, 2007



Hi all,

I have created a report in SSRS 2005 which is being viewed by users from different Time Zones.

I have a dataset which has a field of type datetime (UTC). Now I would like to display this Date according to the User Time Zone.

For example if the date is August 07, 2007 10:00 AM UTC,

then I would like to display it as August 07, 2007 03:30 PM IST if the user Time Zone is IST.


Similarly for other Time Zones it should display the time accordingly.

Is this possible in SSRS 2005?

Any pointers will be usefull...

Thanks in advance
sudheer racha.

View 5 Replies View Related

How To Execute A Stored Procedure From Query Analyzer

Jun 3, 2007

I am trying to execute a stored procedure in Query anaylzer for SQL server 2005. I am not sure I am doing it correctly though, because I am getting an error message. Here is the command I am typing:
execute DetaHistoryGet(84,885,34,"EndDate")
Here is the error message I get:
Msg 102,Level 15, State 1, Line 1
Incorrect syntax near '84'
 
Here are a few lines from the stored procedure. I have not included it all here.
CREATE PROCEDURE [dbo].[DetaHistoryGet]
 (  @MarketId decimal,  @OwnerId decimal,  @QuarterId decimal,  @SortExp nvarchar(50) )
AS SET NOCOUNT ON 

View 3 Replies View Related

How To Execute Update Query Based On Duration

May 21, 2008

Hi All,
I have a table which consists the leave details of an employee.
I have the columns like paid leaves,sick leaves,personal leaves in the above table
Problem :
For eg: An employee joined on 21 May 2008. After 6 months i.e., 21 Nov 2008 I need to update the above columns (i e., increase the no.of leaves)
So updation is to be done for every 6 months and for every 1 year.
Can anyone say me how to execute the update query based on the duration.
Thanks in advance.
 
Regards,
Praveen

View 4 Replies View Related

Lost Some Space (hardisk) When Execute Query

Jul 7, 2004

Dear All,

Got some problem...
how come i lost some space (hardisk) when
execute query...
(the query is listed below)

I want to know is it create some virtual tables or view when we execute query ???
N where's the location in our hardisk ??

thx


Listed Query
---------------------
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Absen.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.DateAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
HRAbsensiKaryawan Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
Union
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Dis.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.TglAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
ADMAbsensiKaryawan Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
UNION
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Dis.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.TglAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
ADMAbsensiBulananSite Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
Union
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Dis.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.DateAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
HRAbsensiKaryawanNonStaf Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
UNION
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Dis.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.DateAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
HRAbsensiKaryawanStaf Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
UNION
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Dis.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.TglAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
LCAbsensiBulananSite Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
UNION
SELECT Absen.BranchID, Bran.BranchName, Bran.BranchNote, Dis.DepartmentID,
Absen.SubDepartmentID, Dis.AfdelingID, Dis.WilayahID,
Dis.KemandoranCivilID, TekCiv.KemandoranCivilName, Absen.TglAbsensi as TglAbsensi,
Absen.AbsensiID, Absen.KaryawanID, Data.JabatanID1, Jab.JabatanName,
Data.GolonganID
FROM AMBranchMaster Bran RIGHT OUTER JOIN
HRDataKaryawan Data LEFT OUTER JOIN
HRDistribusiKaryawan Dis LEFT OUTER JOIN
TEKMasterKemandoranCivil TekCiv ON Dis.KemandoranCivilID = TekCiv.KemandoranCivilID ON
Data.KaryawanID = Dis.KaryawanID RIGHT OUTER JOIN
LCAbsensiIndirect Absen ON Data.KaryawanID = Absen.KaryawanID ON
Bran.BranchID = Absen.BranchID LEFT OUTER JOIN
HRMasterJabatan Jab ON Data.JabatanID1 = Jab.JabatanID
UNION
...................

----------------

View 2 Replies View Related

Execute Query With Interval Date - Out Of Range Value

May 14, 2015

I have problem to execute query with interval date.

If try this query I don't have problem and the output is correct:

Code:
SELECT * FROM dotable
WHERE
dotableDate BETWEEN CONVERT (datetime, '01/01/2015', 121)
AND CONVERT (datetime, '09/01/2015', 121);

Instead if try this I have error:

Code:
SELECT * FROM dotable
WHERE
dotableDate BETWEEN CONVERT (datetime, '25/01/2015', 121)
AND CONVERT (datetime, '28/01/2015', 121);

[Err] 22007 - [SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved