Viewing 15 posts - 49,321 through 49,335 (of 49,566 total)
Does the function have to return a string. It would be easier if it was a table-returning function.
If it has to be a string, you could always count the nuber...
November 21, 2005 at 2:23 am
Could you please post the definition of your table, some example data and expected output please. I'm not completely sure from your description what it is you want.
thanks
November 21, 2005 at 1:43 am
November 21, 2005 at 1:30 am
First, may I suggest you post in a more appropriate forum, like SQL Administration or SQL General. This forum is for discussion of the site's question of the Day, not general...
November 21, 2005 at 12:34 am
Pleasure, got nothing else to do right now. ![]()
(looks cautiously around for boss) ![]()
November 17, 2005 at 2:52 am
You can get variables out. I find, personally, it's the main use of it.
DECLARE @RecordCount INT
EXEC sp_executesql N'SELECT @RecordCountOut=COUNT(*) FROM sysobjects', N'@RecordCountOut INT OUTPUT', @RecordCountOut=@RecordCount OUTPUT
SELECT @RecordCount
It's like a stored procedure...
November 17, 2005 at 2:39 am
Use UNION ALL rather than UNION. There's no possibility of duplicates between the two queries.
UNION means SQL will take the two result sets, concatinate, then sort to remove duplicates. UNION...
November 17, 2005 at 12:19 am
And if you don't know all the columns and need dynamic SQL
B. Execute('Select @NEWVAL = ins.' + @FIELDNAME + ' FROM inserted ins WHERE ins.RegAudited = ' +...
November 17, 2005 at 12:02 am
Actually, come to think of it, the initial insert that you do to insert all the products is unnecessary. If there's a possibility that there will be products in Product_Forcast...
November 15, 2005 at 11:25 pm
btw HTH stands for Hope that helps.
Close, but not quite.
Create the table sales and populate the years and products you want....
November 15, 2005 at 11:16 pm
Why do you not know what database the table is in?
Could you expalin in a bit more detail the situation and what you're trying to do?
November 15, 2005 at 7:12 am
Select * from tbl
where ID IN (SELECT ID FROM tbl WHERE transaction='1000')
AND ID IN (SELECT ID FROM tbl WHERE transaction='2000')
Messy, but it'll work
November 15, 2005 at 6:38 am
If you're using temp tables in order to get values out of dynamic sql, look at sp_executesql. It lets you pass parameters to dynamic sql, both input and output parameters.
November 15, 2005 at 6:32 am
Triggers should be as small as possible. I shudder at the thought of anythihng (especially a trigger) that requires that many variables.
> is it the right way to programm the...
November 15, 2005 at 6:24 am
Viewing 15 posts - 49,321 through 49,335 (of 49,566 total)