Viewing 15 posts - 241 through 255 (of 358 total)
No need for a temp table or the msforeach...
Good catch Gordon. The first thing I thought of was sp_msforeachdb and I usually create a temp table so I get...
July 17, 2008 at 4:20 pm
I just noticed you said for all databases. If you don't mind using an undocumented procedure for sql 2000 this will work.
Create Table #tmp
(dbname varchar(100), RecoveryModel sql_variant)
INSERT INTO...
July 17, 2008 at 10:54 am
This will do it in 2000.
SELECT DATABASEPROPERTYEX(N'DatabaseName', N'RECOVERY')
July 17, 2008 at 10:42 am
I am not sure exaclty why, but here is a workaround. Just concatenate a character and subtract one.
Declare @a char(6)
Set @a = 'a ...
July 17, 2008 at 7:48 am
If the variable is null set the number to itself.
SELECT * FROM tbl1 WHERE number=ISNULL(@number,number)
If the number can be null you have to wrap an isnull around it too since...
July 15, 2008 at 12:05 pm
The best thing I can tell you is to use varchar(8000). Are the comments larger than this? If so, the artilce I posted above shows how to manipulate the...
July 13, 2008 at 7:43 pm
Use varchar(max) instead of text. Make sure you use .write to manipulate the varchar(max) datatype.
July 13, 2008 at 7:37 pm
Check the service account that SQL Server Agent is running under. Make sure that the SQL Server Service account is not running under this user also if you are...
July 13, 2008 at 7:19 pm
item_id should not affect the query because I am grouping by order_id, buyer_id and item_id is not included in the query. I added a few duplicates to test and...
July 13, 2008 at 6:21 pm
Jeffrey,
I know the buyer should never have the same orderid, but if you insert several duplicate records it will not work. Try running your query after adding a few...
July 13, 2008 at 5:35 pm
I think this is what you are looking for.
Select Buyer_ID,Order_ID
FROM (
select order_id, buyer_id,
RANK() OVER (partition BY buyer_id Order by order_id) Rnk
...
July 13, 2008 at 5:15 pm
Here is the Derived Table version. This will also work with 2000 if needed.
Select A.order_id, A.buyer_id, o.order_desc
FROM (select min(b.order_id) order_id, b.buyer_id
from...
July 12, 2008 at 6:44 pm
You can do this with a CTE or Derived Table. Here is the CTE version.
With BuyerOrder
AS
(
select min(b.order_id) order_id, b.buyer_id
from buyer b
join [order] o
on b.order_id = o.order_id
group by b.buyer_id
)
Select...
July 12, 2008 at 6:40 pm
You can check for a correct date format and insert null if it is not correct.
Declare @test-2 as varchar(20)
Set @test-2 = '0'
Select cast( CASE ISDATE(@test) WHEN...
July 12, 2008 at 1:53 pm
If you add the column to the end of the table it is just a simple statement. It really should not matter where the column is in the table anyway.
ALTER...
July 11, 2008 at 11:00 pm
Viewing 15 posts - 241 through 255 (of 358 total)