Showing posts with label available. Show all posts
Showing posts with label available. Show all posts

Friday, March 30, 2012

Scripting a Database

All,
I need to be able to create a script of a database from within a .NET
application. Does anyone know of any code (T-SQL, C# etc.) available to do
this?
Thanks.Search for "SQLDMO .Net" in your favourite search engine and you will get a
ton of info.
Darrel
"Amos J. Soma" <amos_j_soma@.yahoo.com> wrote in message
news:jsCdnac1rpQIBqXeRVn-hg@.buckeye-express.com...
> All,
> I need to be able to create a script of a database from within a .NET
> application. Does anyone know of any code (T-SQL, C# etc.) available to do
> this?
> Thanks.
>|||I was under the impression that SQLDMO was still only available as a COM
object ... thus in .Net, you would have to use a wrapper.
"Darrel Miller" <darrel@.tavis.ca> wrote in message
news:Oc1IaLwwFHA.3236@.TK2MSFTNGP14.phx.gbl...
> Search for "SQLDMO .Net" in your favourite search engine and you will get
> a ton of info.
> Darrel
> "Amos J. Soma" <amos_j_soma@.yahoo.com> wrote in message
> news:jsCdnac1rpQIBqXeRVn-hg@.buckeye-express.com...
>|||Earl wrote:
> I was under the impression that SQLDMO was still only available as a
> COM object ... thus in .Net, you would have to use a wrapper.
> "Darrel Miller" <darrel@.tavis.ca> wrote in message
> news:Oc1IaLwwFHA.3236@.TK2MSFTNGP14.phx.gbl...
That's true, but it's somewhat automated by Visual Studio .Net:
Visual Studio .NET generates an interop assembly containing metadata
when you add a reference to a given type library. If a primary interop
assembly is available, Visual Studio uses the existing assembly before
generating a new interop assembly.
To add a reference to a type library
1.. Install the COM DLL or EXE file on your computer, unless a Windows
Setup.exe performs the installation for you.
2.. From the Project menu, select References.
3.. Select the COM tab.
4.. Select the type library from the Available References list, or
browse for the TLB file.
5.. Click OK.
David Gugick
Quest Software
www.imceda.com
www.quest.com

Scripting a Database

All,
I need to be able to create a script of a database from within a .NET
application. Does anyone know of any code (T-SQL, C# etc.) available to do
this?
Thanks.
You probably need to wrap COM (SQLDMO). Here are some options:
http://www.karaszi.com/SQLServer/inf...ate_script.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Amos J. Soma" <amos_j_soma@.yahoo.com> wrote in message
news:18qdnYXLU7Y_BqXeRVn-gA@.buckeye-express.com...
> All,
> I need to be able to create a script of a database from within a .NET application. Does anyone
> know of any code (T-SQL, C# etc.) available to do this?
> Thanks.
>
|||I used to use SQL-DMO, but when I built my scripts, the dependancies
were off. I found the following article, which takes this into
account:
http://www.sqlservercentral.com/colu...tionscript.asp
It's very fast as well.
Stu

Monday, March 12, 2012

Script for reindexing

Dear all,
Is there any script available to reindex/ re-create index in a given
database.
Important is that script should first create clustered indexes and then non
clustered indexes as recommended by Microsoft.
Regards,
KayYou can generate a SQL script (ensuring to select both DROP and ADD
syntax when setting up the scripting) and then run this to
drop/re-create indexes.
ALI
Kay wrote:
> Dear all,
> Is there any script available to reindex/ re-create index in a given
> database.
> Important is that script should first create clustered indexes and then no
n
> clustered indexes as recommended by Microsoft.
> Regards,
> Kay|||Run the following script in Query Analyzer and set the result as Text to
generate a script that reindexes all the indexes in the right order:
SELECT 'SELECT ''Reindexing index ' + name + ' on table ' + OBJECT_NAME (id)
+ ''''+ CHAR(13) +
'DBCC DBREINDEX(0, ''' + OBJECT_NAME (id) + ''', ''' + name + ''')'
-- + CHAR(13) +
-- 'DBCC SHRINKFILE(1, TRUNCATEONLY)'
FROM sysindexes
WHERE indid BETWEEN 1 AND 254
AND OBJECTPROPERTY(id, 'IsMSShipped') = 0
AND INDEXPROPERTY(id, name, 'IsStatistics') = 0
ORDER BY OBJECT_NAME(id), indid
Jacco Schalkwijk
SQL Server MVP
"Kay" <CallDBA@.hotmail.com> wrote in message
news:%23qXB4f62FHA.3000@.TK2MSFTNGP12.phx.gbl...
> Dear all,
> Is there any script available to reindex/ re-create index in a given
> database.
> Important is that script should first create clustered indexes and then
> non clustered indexes as recommended by Microsoft.
> Regards,
> Kay
>
>|||Books Online, DBCC SHOWCONTIG. Here you find a script that only defrag if fr
ag level is above a
certain threshold. It is easy to change the script to execute DBCC BREINDEX
instead of INDEXDEFRAG.
See http://www.microsoft.com/technet/pr...ver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wrote
in message
news:e%23W1yy62FHA.2676@.TK2MSFTNGP15.phx.gbl...
> Run the following script in Query Analyzer and set the result as Text to g
enerate a script that
> reindexes all the indexes in the right order:
> SELECT 'SELECT ''Reindexing index ' + name + ' on table ' + OBJECT_NAME (i
d)
> + ''''+ CHAR(13) +
> 'DBCC DBREINDEX(0, ''' + OBJECT_NAME (id) + ''', ''' + name + ''')'
> -- + CHAR(13) +
> -- 'DBCC SHRINKFILE(1, TRUNCATEONLY)'
> FROM sysindexes
> WHERE indid BETWEEN 1 AND 254
> AND OBJECTPROPERTY(id, 'IsMSShipped') = 0
> AND INDEXPROPERTY(id, name, 'IsStatistics') = 0
> ORDER BY OBJECT_NAME(id), indid
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Kay" <CallDBA@.hotmail.com> wrote in message news:%23qXB4f62FHA.3000@.TK2MS
FTNGP12.phx.gbl...
>

Script for reindexing

Dear all,
Is there any script available to reindex/ re-create index in a given
database.
Important is that script should first create clustered indexes and then non
clustered indexes as recommended by Microsoft.
Regards,
KayYou can generate a SQL script (ensuring to select both DROP and ADD
syntax when setting up the scripting) and then run this to
drop/re-create indexes.
ALI
Kay wrote:
> Dear all,
> Is there any script available to reindex/ re-create index in a given
> database.
> Important is that script should first create clustered indexes and then non
> clustered indexes as recommended by Microsoft.
> Regards,
> Kay|||Run the following script in Query Analyzer and set the result as Text to
generate a script that reindexes all the indexes in the right order:
SELECT 'SELECT ''Reindexing index ' + name + ' on table ' + OBJECT_NAME (id)
+ ''''+ CHAR(13) +
'DBCC DBREINDEX(0, ''' + OBJECT_NAME (id) + ''', ''' + name + ''')'
-- + CHAR(13) +
-- 'DBCC SHRINKFILE(1, TRUNCATEONLY)'
FROM sysindexes
WHERE indid BETWEEN 1 AND 254
AND OBJECTPROPERTY(id, 'IsMSShipped') = 0
AND INDEXPROPERTY(id, name, 'IsStatistics') = 0
ORDER BY OBJECT_NAME(id), indid
Jacco Schalkwijk
SQL Server MVP
"Kay" <CallDBA@.hotmail.com> wrote in message
news:%23qXB4f62FHA.3000@.TK2MSFTNGP12.phx.gbl...
> Dear all,
> Is there any script available to reindex/ re-create index in a given
> database.
> Important is that script should first create clustered indexes and then
> non clustered indexes as recommended by Microsoft.
> Regards,
> Kay
>
>|||Books Online, DBCC SHOWCONTIG. Here you find a script that only defrag if frag level is above a
certain threshold. It is easy to change the script to execute DBCC BREINDEX instead of INDEXDEFRAG.
See http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx for more
information.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wrote in message
news:e%23W1yy62FHA.2676@.TK2MSFTNGP15.phx.gbl...
> Run the following script in Query Analyzer and set the result as Text to generate a script that
> reindexes all the indexes in the right order:
> SELECT 'SELECT ''Reindexing index ' + name + ' on table ' + OBJECT_NAME (id)
> + ''''+ CHAR(13) +
> 'DBCC DBREINDEX(0, ''' + OBJECT_NAME (id) + ''', ''' + name + ''')'
> -- + CHAR(13) +
> -- 'DBCC SHRINKFILE(1, TRUNCATEONLY)'
> FROM sysindexes
> WHERE indid BETWEEN 1 AND 254
> AND OBJECTPROPERTY(id, 'IsMSShipped') = 0
> AND INDEXPROPERTY(id, name, 'IsStatistics') = 0
> ORDER BY OBJECT_NAME(id), indid
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Kay" <CallDBA@.hotmail.com> wrote in message news:%23qXB4f62FHA.3000@.TK2MSFTNGP12.phx.gbl...
>> Dear all,
>> Is there any script available to reindex/ re-create index in a given database.
>> Important is that script should first create clustered indexes and then non clustered indexes as
>> recommended by Microsoft.
>> Regards,
>> Kay
>>
>

Script for reindexing

Dear all,
Is there any script available to reindex/ re-create index in a given
database.
Important is that script should first create clustered indexes and then non
clustered indexes as recommended by Microsoft.
Regards,
Kay
You can generate a SQL script (ensuring to select both DROP and ADD
syntax when setting up the scripting) and then run this to
drop/re-create indexes.
ALI
Kay wrote:
> Dear all,
> Is there any script available to reindex/ re-create index in a given
> database.
> Important is that script should first create clustered indexes and then non
> clustered indexes as recommended by Microsoft.
> Regards,
> Kay
|||Run the following script in Query Analyzer and set the result as Text to
generate a script that reindexes all the indexes in the right order:
SELECT 'SELECT ''Reindexing index ' + name + ' on table ' + OBJECT_NAME (id)
+ ''''+ CHAR(13) +
'DBCC DBREINDEX(0, ''' + OBJECT_NAME (id) + ''', ''' + name + ''')'
-- + CHAR(13) +
-- 'DBCC SHRINKFILE(1, TRUNCATEONLY)'
FROM sysindexes
WHERE indid BETWEEN 1 AND 254
AND OBJECTPROPERTY(id, 'IsMSShipped') = 0
AND INDEXPROPERTY(id, name, 'IsStatistics') = 0
ORDER BY OBJECT_NAME(id), indid
Jacco Schalkwijk
SQL Server MVP
"Kay" <CallDBA@.hotmail.com> wrote in message
news:%23qXB4f62FHA.3000@.TK2MSFTNGP12.phx.gbl...
> Dear all,
> Is there any script available to reindex/ re-create index in a given
> database.
> Important is that script should first create clustered indexes and then
> non clustered indexes as recommended by Microsoft.
> Regards,
> Kay
>
>
|||Books Online, DBCC SHOWCONTIG. Here you find a script that only defrag if frag level is above a
certain threshold. It is easy to change the script to execute DBCC BREINDEX instead of INDEXDEFRAG.
See http://www.microsoft.com/technet/pro.../ss2kidbp.mspx for more
information.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid > wrote in message
news:e%23W1yy62FHA.2676@.TK2MSFTNGP15.phx.gbl...
> Run the following script in Query Analyzer and set the result as Text to generate a script that
> reindexes all the indexes in the right order:
> SELECT 'SELECT ''Reindexing index ' + name + ' on table ' + OBJECT_NAME (id)
> + ''''+ CHAR(13) +
> 'DBCC DBREINDEX(0, ''' + OBJECT_NAME (id) + ''', ''' + name + ''')'
> -- + CHAR(13) +
> -- 'DBCC SHRINKFILE(1, TRUNCATEONLY)'
> FROM sysindexes
> WHERE indid BETWEEN 1 AND 254
> AND OBJECTPROPERTY(id, 'IsMSShipped') = 0
> AND INDEXPROPERTY(id, name, 'IsStatistics') = 0
> ORDER BY OBJECT_NAME(id), indid
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Kay" <CallDBA@.hotmail.com> wrote in message news:%23qXB4f62FHA.3000@.TK2MSFTNGP12.phx.gbl...
>

script for generating service user account?

Hi,
Is there a script available to create the sql server service account and set
the file system and registry permissions correctly? I would like to run my
server with minimum access rights and I would like to save some time if
someone has done a nice script for creating the account and/or setting the
permissions in a way that it can easily be reused.
Svenhave a look at this
http://support.microsoft.com/kb/283811/en-us
this details what you need to script.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Matzen" <Matzen@.discussions.microsoft.com> wrote in message
news:AA0493D1-A1F6-43F3-9D34-4A590FD410F8@.microsoft.com...
> Hi,
> Is there a script available to create the sql server service account and
> set
> the file system and registry permissions correctly? I would like to run my
> server with minimum access rights and I would like to save some time if
> someone has done a nice script for creating the account and/or setting the
> permissions in a way that it can easily be reused.
> Sven

script for generating service user account?

Hi,
Is there a script available to create the sql server service account and set
the file system and registry permissions correctly? I would like to run my
server with minimum access rights and I would like to save some time if
someone has done a nice script for creating the account and/or setting the
permissions in a way that it can easily be reused.
Svenhave a look at this
http://support.microsoft.com/kb/283811/en-us
this details what you need to script.
--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Matzen" <Matzen@.discussions.microsoft.com> wrote in message
news:AA0493D1-A1F6-43F3-9D34-4A590FD410F8@.microsoft.com...
> Hi,
> Is there a script available to create the sql server service account and
> set
> the file system and registry permissions correctly? I would like to run my
> server with minimum access rights and I would like to save some time if
> someone has done a nice script for creating the account and/or setting the
> permissions in a way that it can easily be reused.
> Sven