Does the size of a stored procedure affect its execution performance?
Is it better to have a large SP that does all the process or to split it to multiple SPs, regarding to performance?
...
Hello all,
I am trying to get the latest record inserted in a SQL table based on its CreatedDate. For instance, in the table below, I would like to get the third row.
A B C 2009-05-04 19:30:52.847
A B D 2009-05-04 19:30:55.050
A B E 2009-05-04 19:30:57.003
I have a working query, but I am wondering if there is better way to ac...
Hi,
How do I make SQL SERVER 2005 to ignore the backslash in the following search:
select [description] from MyTable where contains([description], '3/4 and bear')
It is blowing off on "/"!
...
We have a dev server running C# and talking to SQL server on the same machine.
We have another server running the same code and talking to SQL server on another machine.
A job does 60,000 reads (that is it calls a stored procedure 60,000 times - each read returns one row).
The job runs in 1/40th of the time on the first server compar...
sql server 2005 : i have a column empid in employee table with identity on.if there is some error while inserting data into table .identity is incremented .i want identity to be incremented only if record is inserted .like if i have generated emp id from 1 to 5 and then on 6th record insertion error ocurrs.and on next record insertion id...
I have a script that connects to SQL Server 2005 default instance. But I'm and being connected and instead got the following message
[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [53].
[SQL Native Client]Login timeout expired
[SQL Native Client]An error has occurred while establishing a connection t...
When I restore SQL database by using Microsoft SQL Server Management Studio, it fails and give me this message:
TITLE: Microsoft SQL Server Management Studio
Restore failed for Server 'app1'.
(Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.139...
i need Sql query Convert Table1 to Table2
select Count(Page) as VisitingCount,CONVERT(VARCHAR(5),Date, 108) as [Time] from scr_SecuristLog
where Date between '2009-04-30' and '2009-05-02'
and [user] in(select USERNAME
from scr_CustomerAuthorities where customerID=Convert(varchar,4) and ID=Convert(varchar,43)...
Alright, so I already have an existing connection to Active Directory on my server. I know that querying active directory works. What I want to be able to do is query for all of the ou's and/or groups in active directory, and also be able to find the users the belong to those groups/ous.
this is the current query that just pulls user ...
This kind'a sucks. If I connect to a SQL Server DB (.mdb file) through VS.Net's server explorer, then I can't connect to the same file via SQL Server 2008 Management Studio at the same file. The file is locked.
For example, I get the following error from SQL Server Management Studio
CREATE FILE encountered operating
system error ...
Right now I have this SQL query which is valid but always times out:
SELECT
(
SELECT (MAX(WP_ODOMETER) - MIN(WP_ODOMETER)) / DATEDIFF(DAY, MIN(WP_DATETIME), MAX(WP_DATETIME))
FROM WAYPOINTS
WHERE WP_DATETIME BETWEEN DATEADD(DAY,-14,GETDATE()) AND GETDATE()
AND WP_VTDID = 'L088'
)
AS MAXD,
(
SELECT MAX(WP_ODOMETER)
FROM WAYPOINTS
WHER...
Hi guys,
i have to display Datetime in my gridview, the problem is that while i am inserting values to the database, for default date i am passing "1/1/1900", So when retrieving the data i found the value "01/01/1900 12:00:00 AM" in gridview.
if the datetime is "01/01/1900 12:00:00 AM" i want it as a null value or the corresponding dat...
This query gives me syntax error in when-between line. how can i solve them?
alter FUNCTION [dbo].[fn_GetActivityLogsArranger]
(
@time AS nvarchar(max)
)
RETURNS nvarchar(max)
AS
BEGIN
declare @Return varchar(30)
select @Return = case @time
when between '15:00' and '15:30' then '15:00-15:30'
when between '15:30' and '16:00' then '15...
Hello everyone,
I have an ASP.Net VSTS 2008 project and the project depends on database (SQL Server 2005), it could be opened by VSTS 2008 fine when the machine installed with SQL Server 2005. But when I copy the project to another computer without SQL Server 2005 installed, there is error message like this, any ideas what is wrong?
Fa...
I have Table1 and I need to get it to look like Table2:
Table1
VisitingCount | Date
-----------------------
1 | 15:09
3 | 15:10
7 | 15:15
1 | 15:39
2 | 15:40
3 | 15:47
Table2
VisitingCount | Date
-----------------------------
11 | 15:00-15:30...
Is there any way to force a package to fail from a Send Mail Task? We have a package whose last step is to send a failure message using the Send Mail Task if certain criteria are met. Usually, we create another Script Task directly after the Mail Task which just fails the package using code:
Dts.TaskResult = Dts.Results.Failure
Is the...
i need this table look please TABLE2
Table1
VisitingCount Date
1-------------------15:09
3-------------------15:10
7-------------------15:15
1-------------------15:39
2-------------------15:40
3-------------------15:47
How can i change this table below table
Table2
VisitingCount Date
11-------------------15:00-15:30
6--...
I have a report that was taking a long time to execute. I ran the database engine tuning advisor and one of the recommendations was to create 2 indexes. However, I noticed that the indexes were the same columns, but in different orders.
Here is the table:
---Locations---
| *LocationID |
| Code |
| ...more... |
| DivisionID |...
I need to write a stored procedure to update one of a set of similar columns. The columns are named 'UserField1', 'UserField2' etc. I was hoping to pass a parameter to the SPROC which would set the column to be updated. However, I can't seem to get the code correct. Here's a simplified example of what I tried (which gets me an 'Incor...
I am looking for good resources on Stored Procedures. Particularly for Microsoft SQL server 2005, but any overall good resources for SQL will do. These can be books, websites, etc.
Thanks
...