Viewing 15 posts - 271 through 285 (of 398 total)
Avoid error by following.
create procedure mype
as
DECLARE @a varchar(200)
set @a= 'create table #mytable
( itemcode varchar(15),
itemname varchar(50),
unitname varchar(15)
)'
exec (@a)
You may not be able to...
March 16, 2004 at 3:54 am
truncating & shrinking log is to reduce virtual log file number.
If log files grow to a large size through many small increments, that can slow down recovery.
SQL Server by default,...
March 16, 2004 at 3:41 am
Are you in version 7?
If yes, check PSS ID Number: 273880 on MSDN.
March 16, 2004 at 3:05 am
Is the disk full?
The primary filegroup by default contains all the database system tables. It also contains objects not assigned to user filegroups (or not specified). If you autogrowth your...
March 16, 2004 at 2:59 am
For the first question, if the field name is the key then searching INFORMATION_SCHEMA.COLUMNS
select * from INFORMATION_SCHEMA.COLUMNS where column_name='au_id'
The second could be solved using database diagram in Enterprise Manager.
March 15, 2004 at 6:00 pm
The technical I often use to avoid log grow too large is using set rowcount. It control exactly how many rows to update.
March 15, 2004 at 5:53 pm
Theoretically, the smaller key fields the better. SQL Server manages data in page, which is around 8k size, the smaller the key fields, the more fit in a page, the less...
March 15, 2004 at 5:45 pm
declare @sql varchar(400)
set @sql='select ''?''as dbname;select name, fileid, filename from ?.dbo.sysfiles'
exec sp_msforeachdb @sql
database name is also listed.
March 15, 2004 at 4:23 pm
Execute from query analyzer
declare @sql varchar(400)
set @sql='select name, fileid, filename from ?.dbo.sysfiles'
exec sp_msforeachdb @sql
March 15, 2004 at 12:38 am
User database will be closed when last user disconnect. It applies to start up as well, if no connection, database stay closed until otherwise.
If you do not want the sql...
March 15, 2004 at 12:12 am
Have to use dynamic sql.
Something like
declare @value datetime
set @value = CAST('20040129 15:00:00' AS DATETIME)
DECLARE @tablenames TABLE
(
table_id INT IDENTITY,
table_name SYSNAME
)
INSERT INTO @tablenames (table_name)
SELECT name FROM...
March 12, 2004 at 7:34 am
system stored procedures use return code value for success or failure. @@error is erased with return statement.
Sample:
use pubs
go
create proc sperrtest as
raiserror(15043,16,1)
select @@error
return (0)
go
declare @returncode int
exec @returncode=sperrtest
select @returncode, @@error
go
drop proc sperrtest
March 12, 2004 at 4:50 am
Sample in PSS ID Number: 176480
Old style outer join in pubs database
SELECT titles.title_id, title, qty
FROM titles, sales
WHERE titles.title_id *= sales.title_id
AND stor_id = '7066'
is not the same as
SELECT...
March 12, 2004 at 4:14 am
Viewing 15 posts - 271 through 285 (of 398 total)