Viewing 15 posts - 2,266 through 2,280 (of 2,462 total)
cnayan (3/19/2013)
My question is the latter one - which is more efficient.
I tested this a little and here's what I determined: Both queries you posted will produce the exact...
-- Itzik Ben-Gan 2001
March 19, 2013 at 12:26 pm
pehlebhiayatha (3/19/2013)
Sorry for the late response. I tested the script and it works great. But I want to split the backup files to multiple files if the database size is...
-- Itzik Ben-Gan 2001
March 19, 2013 at 11:34 am
I worked on this for awhile and this was the best I could come up with...
-- SAMPLE DATA
IF OBJECT_ID('tempdb..#Weekday') IS NOT NULL DROP TABLE #Weekday; CREATE TABLE #Weekday(Weekday_id int...
-- Itzik Ben-Gan 2001
March 19, 2013 at 9:53 am
zouzou (3/12/2013)
I have a live db that users need to access it for reporting purposes. What is the best way to let them access [it] without [affecting live]?
They...
-- Itzik Ben-Gan 2001
March 15, 2013 at 4:30 pm
Please don't double post.
I inlcuded a better script for handling this
in your original post that does not include any cursors or loops.
P.S. if you search online for a way...
-- Itzik Ben-Gan 2001
March 15, 2013 at 3:48 pm
something like this...
DECLARE @sql VARCHAR(8000);
--Set your threshold here
DECLARE @big int=1000--mb
;WITH dbs([dbid],size) AS
(SELECT database_id,
SUM(size)/128
FROM sys.master_files
GROUP BY database_id )
SELECT @sql = COALESCE(@sql,'')+
CASE
WHEN size < @big
THEN 'BACKUP DATABASE '+d2.name+'...
-- Itzik Ben-Gan 2001
March 15, 2013 at 3:03 pm
Based on what I can make of your post I think you are looking for this:
--sample data
DECLARE @x TABLE (id int not null, value char(1) not null, primary key(id,value));
INSERT INTO...
-- Itzik Ben-Gan 2001
March 15, 2013 at 12:37 pm
Jeff Moden (3/15/2013)
I suppose you could take what was said two ways. I may have taken it the wrong way.
I was not 100% clear in what I said. I...
-- Itzik Ben-Gan 2001
March 15, 2013 at 12:00 pm
Jeff Moden (3/14/2013)
Alan.B (3/7/2013)
For tables you would do this:
EXEC sp_MSforeachtable'SELECT TOP 1...
-- Itzik Ben-Gan 2001
March 15, 2013 at 9:24 am
Well, Eugene beat me to it and with something better than what I put together.
--Next time provide some DDL like so....
--1) Lets setup that test data
IF OBJECT_ID('tempdb..#classes') IS NOT...
-- Itzik Ben-Gan 2001
March 14, 2013 at 11:52 am
kevaburg (3/14/2013)
What about using:exec sp_MSforeachview 'select top 1 from ?'
That is not a stored proc that comes from SQL Server. If you can run this:
exec sp_MSforeachview 'select top 1 from...
-- Itzik Ben-Gan 2001
March 14, 2013 at 11:05 am
Mick Opalak (3/13/2013)
-- Itzik Ben-Gan 2001
March 13, 2013 at 4:26 pm
Eugene Elutin (3/13/2013)
Alan.B (3/13/2013)
Eugene Elutin (3/13/2013)
declare @filename varchar(100)
set @filename = 'Notes_20130204_003015.txt';
select PARSENAME(replace(@filename,'_','.'),4)
select PARSENAME(replace(@filename,'_','.'),3)
select PARSENAME(replace(@filename,'_','.'),2)
select PARSENAME(replace(@filename,'_','.'),1)
Fantastic use of PARSENAME! Wow!
Not really. Quite slow one, actually. But will suite to...
-- Itzik Ben-Gan 2001
March 13, 2013 at 4:01 pm
Eugene Elutin (3/13/2013)
declare @filename varchar(100)
set @filename = 'Notes_20130204_003015.txt';
select PARSENAME(replace(@filename,'_','.'),4)
select PARSENAME(replace(@filename,'_','.'),3)
select PARSENAME(replace(@filename,'_','.'),2)
select PARSENAME(replace(@filename,'_','.'),1)
Fantastic use of PARSENAME! Wow!
-- Itzik Ben-Gan 2001
March 13, 2013 at 2:56 pm
First, welcome to SSC.
I suggest you re-post this under the programming - general forum and be prepared to provide a little extra detail; you will have better luck. What...
-- Itzik Ben-Gan 2001
March 12, 2013 at 10:20 pm
Viewing 15 posts - 2,266 through 2,280 (of 2,462 total)