<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlserver.ro/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Intrebari generale</title><link>http://sqlserver.ro/forums/16/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4404.aspx</link><pubDate>Tue, 18 Mar 2008 08:15:42 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4404</guid><dc:creator>aflorin27</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4404.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4404</wfw:commentRss><description>&lt;DIV&gt;Aveam si eu o aplicatie C# cu care faceam asa ceva. Procedam asa:&lt;/DIV&gt;
&lt;DIV&gt;- aveam doua tipuri de useri, unul ce avea drepturi de creare baze de date, altul doar de conectare si I/U/D + Select&lt;/DIV&gt;
&lt;DIV&gt;- ma conectam cu primul user si:&lt;/DIV&gt;
&lt;DIV&gt;cream noua baza de date&lt;/DIV&gt;
&lt;DIV&gt;adaugam la ea userii din categoria II&lt;/DIV&gt;
&lt;DIV&gt;cream tabelele pe care le voiam "default"&lt;/DIV&gt;
&lt;DIV&gt;faceam inserturile pe ele, pentru a pune si valorile "default"&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Dupa aceea conexiunile se faceau cu userii de tipul II&lt;/DIV&gt;</description></item><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4362.aspx</link><pubDate>Thu, 13 Mar 2008 07:09:33 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4362</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4362.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4362</wfw:commentRss><description>Pentru asta pregatesti un script / o procedura&amp;nbsp;care creeaza obiecte "user" in noua baza de date si populeaza tabelele.</description></item><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4358.aspx</link><pubDate>Wed, 12 Mar 2008 20:52:44 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4358</guid><dc:creator>ThePuiu</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4358.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4358</wfw:commentRss><description>&lt;P&gt;cind am spus 'valori default' ma refeream nu la valoarea cu care se initializeaza&amp;nbsp;coloana x la adaugarea unui nou record, ci la un set de valori (recorduri) care trebuie sa fie intr-o anumita tabela in momentul instalarii aplicatiei.&lt;/P&gt;
&lt;P&gt;Multumesc inca o data pt implicare!&lt;/P&gt;</description></item><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4356.aspx</link><pubDate>Wed, 12 Mar 2008 18:17:19 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4356</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4356.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4356</wfw:commentRss><description>&lt;P&gt;S-ar potrivi aici si un trigger&amp;nbsp;DDL care sa monitorizeze crearea / distrugerea obiectelor. Un sfat bun gasesti aici:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.sqlskills.com/blogs/kimberly/2007/07/24/EXECUTEASAndAnImportantUpdateYourDDLTriggersForAuditingOrPrevention.aspx"&gt;http://www.sqlskills.com/blogs/kimberly/2007/07/24/EXECUTEASAndAnImportantUpdateYourDDLTriggersForAuditingOrPrevention.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In ceea ce priveste valorile default nu te ajuta sa definesti DEFAULT-uri pe coloane?&lt;/P&gt;</description></item><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4353.aspx</link><pubDate>Wed, 12 Mar 2008 13:31:58 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4353</guid><dc:creator>xmldeveloper</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4353.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4353</wfw:commentRss><description>&lt;P&gt;Adaugand la ideea Dianei, se poate face o procedura stocata:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;PROCEDURE&lt;/SPAN&gt; dbo.usp_ManageDB @DBName &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;NVARCHAR&lt;/SPAN&gt;(128) &lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;AS&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;BEGIN&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;DECLARE&lt;/SPAN&gt; @sqlstatement &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;NVARCHAR&lt;/SPAN&gt;(150);&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;SET&lt;/SPAN&gt; @sqlstatement = &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;'DROP DATABASE '&lt;/SPAN&gt;+@DBName;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;EXEC&lt;/SPAN&gt; (@sqlstatement) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;AS&lt;/SPAN&gt; LOGIN=&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;'LoginWithRights'&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;END&lt;/SPAN&gt;;&lt;BR&gt;GO&lt;/SPAN&gt;&lt;/P&gt;</description></item><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4333.aspx</link><pubDate>Sun, 09 Mar 2008 20:47:41 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4333</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4333.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4333</wfw:commentRss><description>&lt;P&gt;Poti folosi "perechea" de comenzi "EXECUTE AS" - "REVERT".&amp;nbsp;Cu "EXECUTE AS"&amp;nbsp;setezi alt&amp;nbsp;context de executie - de exemplu baza de date va fi creata de catre "cine trebuie" &lt;img src="http://sqlserver.ro/emoticons/emotion-1.gif" alt="Smile" /&gt;. Cu "REVERT" revii la starea initiala. De exemplu, presupunand ca esti un user "obisnuit", fara dreptul de a crea baze de date:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;SELECT&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;SUSER_SNAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(),&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;USER_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;()&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;USE&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;master&lt;/P&gt;
&lt;P&gt;EXECUTE&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AS&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;LOGIN&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;'login1'&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;SELECT&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;SUSER_SNAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(),&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;USER_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;()&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;CREATE&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;DATABASE&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; test&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#000000&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;REVERT;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;- login1 este "dbcreator"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;Cu&amp;nbsp;&lt;FONT color=#0000ff&gt; &lt;/FONT&gt;SELECT&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;SUSER_SNAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(),&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;USER_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;()&amp;nbsp;&amp;nbsp;"vezi" contextul de executie curent.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;Inainte de "EXECUTE AS", userului/loginului tau trebuie sa-i "dai" permisiunea de "IMPERSONATE" pentru "login1"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;</description></item><item><title>Re: Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4309.aspx</link><pubDate>Fri, 07 Mar 2008 03:44:31 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4309</guid><dc:creator>ignatandrei</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4309.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4309</wfw:commentRss><description>1. Daca tu ii instalezi SQL Server Express, ai putea modifica DB-ul model -sa semene cu ce vrei tu.&lt;br&gt;2. Poti pune permisiuni pe un alt user ca sa faca Create DAtabase&lt;br&gt;"CREATE DATABASE permission defaults to members of the &lt;b&gt;sysadmin&lt;/b&gt; and &lt;b&gt;dbcreator&lt;/b&gt; fixed server roles. Members of the &lt;b&gt;sysadmin&lt;/b&gt; and &lt;b&gt;securityadmin&lt;/b&gt; fixed server roles can grant CREATE DATABASE permissions to other logins. Members of the &lt;b&gt;sysadmin&lt;/b&gt; and &lt;b&gt;dbcreator&lt;/b&gt; fixed server role can add other logins to the &lt;b&gt;dbcreator&lt;/b&gt; role. The CREATE DATABASE permission must be explicitly granted; it is not granted by the GRANT ALL statement."&lt;br&gt;Vezi&lt;br&gt;http://msdn2.microsoft.com/en-us/library/aa258257(SQL.80).aspx&lt;br&gt;</description></item><item><title>Creeare/atasare baza de date</title><link>http://sqlserver.ro/forums/thread/4306.aspx</link><pubDate>Fri, 07 Mar 2008 01:07:53 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:4306</guid><dc:creator>ThePuiu</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/4306.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=4306</wfw:commentRss><description>&lt;P&gt;Salut! Vreau sa fac o aplicatie care sa permita userului sa adauge/stearga baze de date intr-un Server Express 2005. Acestea sint initial identice (contin tabele cu valori introduse default si proceduri stocate, si au definit un user 'User' db_owner) si se vor particulariza ulterior.&lt;BR&gt;Am observat ca pt a putea executa din aplicatia C# "CREATE DATABASE XXX ..." trebuie ca userul folosit sa aiba setata propritatea "Server Roles' ca &lt;STRONG&gt;&lt;EM&gt;sysadmin. &lt;/EM&gt;&lt;/STRONG&gt;Cred ca nu e bine ca acest drept sa fie setat default si permanent, deci imi pun intrebarea daca nu ar fi mai bine sa-l setez numai inainte de a creea noua baza de date. Intrebare: care este sintaxa care imi permite setarea/desetarea rolului in runtime pt un anumit user?&lt;BR&gt;Structura interna a tabelei o pot reconstitui cu ajutorul unui script generat si rulat runtime. O alta intrebare ar fi: cum pot sa recreez in baza de date nou formata valorile care trebuie sa fie default in tabele - destul de multe ca numar de recorduri (~200 recorduri)?&lt;/P&gt;
&lt;P&gt;O idee mai simpla ar fi sa fac append la server a unei baze de date pe baza unor fisiere gata creeate (generate prin simpla copiere a fisierelor MDF si LDF default). In acest caz as avea automat in baza nou atasata structura si datele default! Si in acest caz am nevoie de aceeasi setare a server roles...&lt;/P&gt;
&lt;P&gt;Care metoda este mai 'profesionala'? Avind in vedere ca operatia nu se va executa foarte des sau&amp;nbsp;de un numar mare de ori, prefer o metoda sigura, nu neaparat rapida.&lt;/P&gt;
&lt;P&gt;Sper ca am fost suficient de coerent pt a ma putea face inteles! Daca nu, va stau la dispozitie!&lt;BR&gt;Multumesc anticipat!&lt;/P&gt;</description></item></channel></rss>