Viewing 15 posts - 1 through 15 (of 26 total)
Normally if someone is looking to write this kind of dynamic code it can be rewritten so that the column names/database names are actually contained within the rows.
e.g. I've seen...
August 23, 2004 at 12:49 pm
After IF @@ERROR 0 in each case you have multiple statements - you need to surround these by BEGIN and END. As it works just now if there...
August 23, 2004 at 12:42 pm
If the part that is dynamic includes the structure of the tables - e.g. column names, table names, then these can't be parameterised directly.
You can however do the following:
Insert everything...
August 20, 2004 at 8:22 am
Rearrange order and check count(*)...
IF @sProductManufacturer IS NULL
BEGIN
IF (SELECT count(*)
FROM TblCartProducts
WHERE (ProductCategory = @sProductCategory)
AND (SubCat1 = @sSubCategory)
AND (BestSell =...
August 20, 2004 at 8:06 am
If you add a clustered index to the table though....
create clustered index idx_foo on #clients (clientid)
--cost = .0443
select c1.ClientID
From #Clients c1
JOIN #Clients c2 on c1.ClientID = c2.ClientID
where c1.RegionID = 1...
August 19, 2004 at 9:11 pm
Can you actually send an email using Outlook on the box? Make sure you actually can send an email, if you can, then leave Outlook running and see if that...
August 19, 2004 at 12:54 pm
I've not done this for a while but I believe if you stick what you want inside a stored procedure and handle the error from outside the stored procedure then...
August 19, 2004 at 10:48 am
ISDATE ( expression )
Use the above before attempting to convert.
Dave Hilditch.
August 19, 2004 at 9:57 am
You'll want to look at using the parameters available for xp_startmail to select the relevant profile you have created.
BOL -
xp_startmail [[@user =] 'mapi_profile_name']
[,[@password =] 'mapi_profile_password']
But I would warn...
August 19, 2004 at 9:53 am
You can't get the previous or next row in from this table because there is nothing to tell you what to order by. Can't assume that OrderID will always raise...
August 18, 2004 at 6:08 pm
Have you thought about rotating the columns so they become rows?
e.g
Have a table UserTables(userid, tablename, columnname, value)
Then you wouldn't need to use dynamic SQL.
Otherwise, from what I remember (I...
August 18, 2004 at 5:01 pm
From what I can tell you want your first query to be the inner query of the second query. If this is what you want, remove the ORDER BY clause...
August 18, 2004 at 4:53 pm
Here's a couple of methods:
create table clients (clientid int, regionid int)
insert into clients
select 222,1
union
select 222,28
union
select 444,1
union
select 444,44
select clientid from
clients
where regionid = 28
and clientid...
August 18, 2004 at 4:44 pm
create function leftNumberPart(@code varchar(10)) returns int as begin declare @number varchar(10) declare @position tinyint set @position = 1
set @number = '' while @position < len(@code) begin if isnumeric(substring(@code, @position, 1)) = 1 set @number = @number + substring(@code, @position, 1) else break set...
August 5, 2004 at 6:39 am
If you change SERVER=localhost does it remove the linked server error?
If not, then add the linked server using the IP address above in Enterprise Manager (under Security). The localhost thing...
August 4, 2004 at 6:25 am
Viewing 15 posts - 1 through 15 (of 26 total)