Viewing 15 posts - 1 through 15 (of 5,356 total)
This line is in your script:
SET @cmd = 'ALTER INDEX ['+@IndexName+'] ON [dbo].'+@TableName+'] REBUILD
Fill that with life:
DECLARE @cmd varchar(200), @indexname varchar(200), @tablename varchar(200)
SELECT @indexname = '', @tablename = ''
SET @cmd...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 12, 2009 at 5:48 am
Oops, apparently you would want to repleace #t with a permanent table in the AdventureWorks database. 🙂
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 12, 2009 at 4:58 am
Maybe something like this will work:
CREATE TABLE #t (c1 int);
DECLARE @i int;
SET @i = 1;
WHILE @i <= 10 --adjust this
BEGIN
INSERT INTO #t SELECT @i;
UPDATE #t SET c1 = @i;
DELETE #t...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 12, 2009 at 4:57 am
Then why not run INSERT and DELETE statement in a loop?
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 12, 2009 at 4:49 am
A good way to check the correctness of a SQL string before executing it, is top PRINT it. You will notice that you are missing an opening bracket before @TableName
SET...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 12, 2009 at 4:45 am
Too lazy to Google? 😉
http://en.wikipedia.org/wiki/Database_management_system
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 28, 2009 at 4:53 am
SELECT DATEADD (DAY, DATEDIFF (DAY, 0, '2009-05-28 11:18:49.123'), 0)
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 28, 2009 at 3:23 am
Sorry, if I was a bit lazy in my reply 🙂
I still keep forgetting about it, but another alternative in SQL Server 2005 might look something like this:
DECLARE @Output TABLE...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 28, 2009 at 12:10 am
Have a look at the EXISTS () clause in Books Online. You can test if at least 1 row matches the criteria and if so do the UPDATE along with...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 27, 2009 at 2:57 pm
GilaMonster (5/26/2009)
The requirement for being first normal forum is that there are no repeating groups. If we take the addresses as repeating groups, then this isn't...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 26, 2009 at 1:21 pm
It is First Normal Form and normally you would want to have your model in Third Normal Form or even higher.
If you need some good arguments for the design discussion...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 26, 2009 at 8:29 am
Can you please post your actual code?
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 26, 2009 at 5:52 am
The only thing I can think of right now is that the "Script for server version" option is "SQL Server 2000". In that case the INCLUDE clause is ignored
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
May 26, 2009 at 5:47 am
A way to mimic this Access behaviour would be to right-click on the stored procedure in SSMS -> Execute -> and then supply the values in the window that opens...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 31, 2008 at 3:47 am
nazaninahmady_sh (12/31/2008)
for example iwant to write "exec Garhasbi...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 31, 2008 at 3:45 am
Viewing 15 posts - 1 through 15 (of 5,356 total)