I'm testing a stored procedure and wanted to submit 'GETDATE()' function in place of parameter:
DECLARE @return_value int
EXEC @return_value = my_store procedure
@MyId = 1,
@MyDateField = GETDATE()
SELECT 'Return Value' = @return_value
GO
SQL Server 2005 complains with following error:
Incorrect syntax near ')'.
Anybody cares to shed some light on the matter?
Thanks
per MSDN
Execute a stored procedure or function
[ { EXEC | EXECUTE } ]
{
[
In sql server 2005/2008, can anyone please advise me on how can i generate scripts automatically of all the objects that let say starts with "Client_"
I already have a query that identifies all the object that starts from "client_", but i also want to generate there scripts automatically. Doing it manually is a huge task.
select name,type_desc
from sys.objects
where object_definition(object_id) like '%client_%'
Please advise
Massive thanks
Amit
I think you should use
What is a good ORM to use for rapid prototyping without the hurt?
I've used LINQ-to-SQL with great success, but I always end up building a whole repository layer around it (and everything that entails) so I don't have to put "Insert/Update" and mapping logic in my controllers. If I want to add a column, I have to write migrations and update interfaces and repositories.
I'd like something that just works. db4o is a good candidate, but I've always had gripes with the lack of proper
I have the following table in SQL Server Express edition:
Time Device Value
0:00 1 2
0:01 2 3
0:03 3 5
0:03 1 3
0:13 2 5
0:22 1 7
0:34 3 5
0:35 2 6
0:37 1 5
The table is used to log the events of different devices which are reporting their latest values. What I'd like to do is to prepare the data in a way that I'd present the average data through time scale and eventually create a chart using this data. I've manipulated this example data
Is there a simple way to do that?
Perhaps just export to shapefile or kml and then reimport to SQL Server using one of these standard tools. For example:
SELECT ST_AsKML(the_geom) FROM the_spatial_table WHERE ....
This outputs kml, which you can then reimport to SQL Server (I assume, not SQL server guy, but it is a common format.) Here: http://www.postgis.org/documentation/manual-1.4/ch07.html#Geometry_Outputs are the other geometry output formats for Postgis.
Need to build a query showing how much customers spend money per week, month, quarter, 6 months and a year on a daily on-line game. There is a field create date(datetime) field when one customer enters the game.
Can anyone help?
Perhaps something like this.
declare @T table (CreatedDate datetime, MoneySpent int)
insert into @T values
('20101231', 5),
('20100101', 10),
('20100102', 20),
('20100103', 30),
('20110104', 40),
('20110105', 50),
('20110106', 60),
('20110107',
I'm currently experiencing a strange issue that my understanding of SQL server doesn't quite mesh with. We use SQL as our file storage for our internal storage service, and our database has about half a million rows in it. Most of the files (86%) are 1mb or under, but even on fresh copies of our database where we simply populate the table with data for the purposes of a test, it appears that rows with large amounts of data stored in a BLOB frequently cause timeouts when our SQL server
I need to use a function which returns a table, in a inner join sentence passing a parameter. When executed, the sentence like this is not working.
SELECT T0.Code,T0.Data1,T0,Data2 FROM [dbo].[FNGet_Data] (T1.Code,'2010-01','USD') T0
INNER JOIN
Codes T1 ON T1.Code=T0.Code
When executed the sentence using a constant parameter works ok
SELECT T0.Code,T0.Data1,T0,Data2 FROM [dbo].[FNGet_Data] ('5200','2010-01','USD') T0
INNER JOIN
Codes T1 ON T1.Code=T0.Code
Is it possible to
I'm trying to search resumes using a boolean free text search and need to run a subquery. However I can't work out if free text boolean searches are possible with subqueries.
Please could you confirm if it is and if possible reference a link for further investigation?
Yes you can - in SQL Server 2008 r2 at least! I have just tried the following query in SQL Server management studio and it parsed and executed correctly:
SELECT * FROM Resumes WHERE CONTAINS (ResumeText, 'admin*')
I have the following table:
ID Type Description IDOfSystem
--------------------------------
1000 Company Company Item NULL
1010 System System Item NULL
1020 Company NULL 1010
I have System and Company Items. I need to write a select query that gets all the company items and system items UNLESS if a company item has a value in IDOfSystem I need to exclude that system item and get the description from the system item.
So, given the above table, the SQL select
I have transactional replication running between two servers over a dedicated VPN connection. The databases are fairly large, so I initially use the backup and restore method to get the initial snapshot over to the subscriber machine and then let it apply the incremental transactions from there.
Everything runs fine until the VPN line gets flaky (which it does occassionally) at which point the replication process is prone to locking up. When I look on the subscriber side, there are a
is is good or doesn't matter or bad to INCLUDE the primary key in a covering index??
CREATE NONCLUSTERED INDEX index_name_here ON dbo.table_name_here
(column_to_index_here)
INCLUDE (primary_key_column,other_column_here)
WITH( STATISTICS_NORECOMPUTE=OFF, IGNORE_DUP_KEY=OFF, --<default junk from SSMS
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
I'm thinking it doesn't matter, since the PK will be in the index anyways.
EDIT - to clarify.
my primary_key_column is