<?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</title><link>http://sqlserver.ro/forums/14/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3323.aspx</link><pubDate>Wed, 14 Nov 2007 18:32:37 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3323</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3323.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3323</wfw:commentRss><description>&lt;p&gt;Am avut si eu ceva timp liber dupa amiaza asta pentru polemică. &lt;/p&gt;&lt;p&gt;Îmi place să polemizez. &lt;img src="http://sqlserver.ro/emoticons/emotion-5.gif" alt="Wink" /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3322.aspx</link><pubDate>Wed, 14 Nov 2007 17:54:15 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3322</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3322.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3322</wfw:commentRss><description>&lt;p&gt;Remarca mea iniţială apropos de portabilitatea unui asemenea query era cam în glumă ("metode complicate pentru a face un lucru simplu"). În lucrul de zi cu zi şi eu prefer performanţa, în detrimentul portabilităţii (dacă aceasta din urmă nu este o cerinţă explicită).&lt;/p&gt;&lt;p&gt;Referitor la întrebarea "la ce este util un standard daca nu-l respecta cei mai importanti jucatori din domeniu ?"... nu am niciun răspuns. Putem doar să sperăm că în viitor producătorii vor respecta standardele, dar este foarte posibil ca asta să fie o speranţă deşartă...&lt;br&gt;&lt;/p&gt;&lt;p&gt;Pe de altă parte, mi-a scăpat partea cu parantezele pătrate, trebuia să folosesc un nume fără spaţii (sau ghilimele duble dacă vroiam neapărat spaţiu în numele coloanei).&lt;/p&gt;&lt;p&gt;Răzvan&lt;/p&gt;&lt;p&gt;PS. Îmi cer scuze dacă te-au supărat cu ceva remarcile din mesajul meu anterior. Încercam doar să scriu ceva haios (şi destul de puţin interesant) ca răspuns la o problemă banală, negăsind alte lucruri mai interesante de scris. Dar se pare că umorul nu e punctul meu forte.&lt;br&gt;&lt;/p&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3321.aspx</link><pubDate>Wed, 14 Nov 2007 16:19:52 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3321</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3321.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3321</wfw:commentRss><description>&lt;p&gt;INSERT INTO @v&lt;br&gt;EXEC sp_tables&lt;br&gt;Evident ca INSERT INTO @variabila_tabela EXEC procedura conduce la obtinerea unei erori in SQL Server 2000 iar BOL 200 e foarte clara cu privire la acest tip de interogari ! Erori vei obtine daca vei incerca sa apelezi o functie/vedere DMF/DMV in SQL Server 2000 ! Sa mai zic ca - de exemplu - exista diferente (evidente) intre o versiune SQL Server non SP si una cu SP ? Si pentru ca tot a amintit xmldeveloper de sys.dm_... am sa enumer 2 vederi DMV care sunt disponibile incepand doar de la sp1: sys.dm_exec_query_memory_grants si sys.dm_exec_query_resource_semaphores.&lt;br&gt;&lt;br&gt;&lt;b&gt;TOP 1 diminueaza portabilitatea interogarii doar daca ea ar fi fost portabila [?] !&lt;/b&gt;&lt;br&gt;Pe mine ma intereseaza mai putin portabilitatea in lipsa unei cerinte &lt;font color="#ff0000"&gt;&lt;b&gt;EXPLICITE&lt;/b&gt;&lt;/font&gt; in acest sens. De regula, functionalitatile cele mai interesante sunt cele neportabile sau mai putin portabile. Intentia mea a fost aceea de a minimiza timpii suplimentati de procesare a clauzei DISTINCT. Evident ca in ceea ce priveste SQL Server si cele doua exemple care utilizeaza sp_tables si information_schema_tables se apeleaza function db_name().&lt;br&gt;&lt;br&gt;Legat de portabilitate:&lt;br&gt;Intrebarea mea este la ce este util un standard daca nu-l respecta cei mai importanti jucatori din domeniu ? Plus ca nici MS nu respecta standardul (dintre multitudinea de exemple: vezi tipuri de date DATE, TIME din SQL 2008 :-) :-) :-), vezi TIMESTAMP :-) asta ca sa dau doar cateva exemple) ! Sa mai vorbim despre anumite comenzi, clauze, operatori ... din standardul SQL care sunt suportate de mai multi producatori dar comportamentul este DIFERIT desi sintaxa este identica (vezi LIKE in SQL Server / Oracle ... care este ba insenzitiv ba senzitiv &lt;b&gt;implicit&lt;/b&gt;, ca sa dau doar un exemplu) ? Aceata interogare &lt;br&gt;SELECT * FROM tabela WHERE camp LIKE 'A%'&lt;br&gt;este in doar in aparenta portabila deoarece conduce la obtinerea unor rezultate &lt;b&gt;diferite&lt;/b&gt;.&lt;/p&gt;&lt;p&gt;Si discutia poate continua ... ! Se pot scrie carti intregi cu privire la diferentele &lt;br&gt;dintre diferitele implementari ale pseudostandardelor SQL si cum se poate scrie cod SQL portabil. Si repet ce am spus mai sus: codul SQL portabil &lt;b&gt;(DACA E PORTABIL)&lt;/b&gt; nu are nici un farmec.&lt;br&gt;&lt;br&gt;Pentru ca tot a venit vorba de standarde, ce crezi ca va afisa Oracle sau/si MySql daca se incearca apelul urmator:&lt;br&gt;SELECT DISTINCT TABLE_CATALOG AS [Current Database] FROM INFORMATION_SCHEMA.TABLES&lt;br&gt;?&lt;br&gt;Cate o eroare. &lt;br&gt;Oracle: in primul rand identificatorul aliasului nu este recunoscut de Oracle ( ... AS [...] ) si in al doilea rand vederile din schema information_schema definita in standardul SQL nu sunt disponibile in Oracle. &lt;br&gt;MySql: de asemenea identificatorul aliasului nu este recunoscut de MySql. MySql recunoaste vederea information_schema.tables dar distractia abia acuma incepe pentru ca acel camp table_catalog (dupa care faci distinct in interogare) contine (conform documentatiei MySql 5) valori nule. Supriza ? Daca vb. de MySql nu nici o supriza. Au avut bug-uri si mai si ... (vezi cazul in care valorile 0 erau considerate null :-) :-) :-) ). Conform documentatie trebuie utilizat campul table_schema pentru a identifica tabela (tabela DA si nu schema; MySql e iarasi varza) de care apartine un obiect (tip tabela). Problema e ca MySql imi afiseaza in aceasta vedere obiecte la care am acces, din toate bazele de date (sunt conectat ca administrator) si nu doar acele obiectele din baza de date curenta la care utilizatorul este conectat asa cum procedeaza SQL Server. Standardul spune ca vederea tables trebuie sa permita vizualizarea tabelelor definite "in acest catalog" [tabele] care sunt accesibile utilizatorului. Se pare ca doar SQL Server (comparativ cu Oracle si MySql) are implementata vederea corect.&lt;br&gt;&lt;br&gt;Totusi intrebarea este: unde e portabilitatea in acest caz ?&lt;br&gt;&lt;br&gt;Daca s-ar fi solicitat din start o solutie pentru accesarea numelui bazei de date curenta orientata pe SQL Server / Oracle / MySql o solutie pe care as&amp;nbsp; fi putut sa o indic ar fi fost:&lt;br&gt;&lt;span style="font-family:courier new,courier;"&gt;CREATE VIEW MetadataDatabaseName&lt;/span&gt;&lt;br style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;AS&lt;/span&gt;&lt;br style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;SELECT DB_NAME() AS Name&lt;/span&gt;&lt;br&gt;&lt;br&gt;respectiv &lt;br&gt;&lt;br&gt;&lt;span style="font-family:courier new,courier;"&gt;CREATE VIEW MetadataDatabaseName&lt;/span&gt;&lt;br style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;AS&lt;/span&gt;&lt;br style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;SELECT GLOBAL_NAME AS Name FROM GLOBAL_NAME&lt;/span&gt;&lt;br&gt;&lt;br&gt;respectiv &lt;br&gt;&lt;br&gt;&lt;span style="font-family:courier new,courier;"&gt;CREATE VIEW MetadataDatabaseName&lt;/span&gt;&lt;br style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;AS&lt;/span&gt;&lt;br style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;SELECT DATABASE() Name &lt;/span&gt;&lt;br&gt;&lt;br&gt;Vederea MetadataDatabaseName abstractizeaza denumirea bazei de date curente de tipul bazei de date (SQLServer/Oracle/MySql) a.i. interogarea &lt;br&gt;SELECT Name FROM MetadataDatabaseName &lt;br&gt;va fi portabila.&lt;br&gt;&lt;br&gt;Intrebare intrebatoare:&lt;br&gt;De ce crezi ca Oracle si MySql afiseaza mesajul de eroare generat de identificatorul [Current Database] ?&lt;/p&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3315.aspx</link><pubDate>Wed, 14 Nov 2007 06:17:07 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3315</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3315.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3315</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;B_gd_n[ ]Sahlean:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;Dar dacă înlocuim DISTINCT cu TOP 1 ?&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Atunci query-ul nu mai e aşa de portabil, pentru că TOP este o extensie proprietară (nu face parte din standardul SQL). &lt;img src="http://sqlserver.ro/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;B_gd_n[ ]Sahlean:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;



&lt;p class="MsoNormal"&gt;[...]&lt;br&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;INSERT&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt; &lt;span style="color:blue;"&gt;INTO&lt;/span&gt; @v&lt;o:p&gt;&lt;/o:p&gt;&lt;br&gt;EXEC&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt; &lt;span style="color:maroon;"&gt;sp_tables&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;[...]&lt;/p&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&lt;/span&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;În SQL 2000, apare eroarea "EXECUTE cannot be used as a source when inserting into a table variable.", dar în SQL 2005 merge (la fel de "bine" ca celelalte variante sugerate...&amp;nbsp;&lt;img src="http://sqlserver.ro/emoticons/emotion-1.gif" alt="Smile" /&gt;).&lt;/p&gt;&lt;p&gt;Răzvan&lt;br&gt;&lt;/p&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3314.aspx</link><pubDate>Tue, 13 Nov 2007 21:10:20 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3314</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3314.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3314</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;rsocol:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;Dacă tot vrem metode complicate pentru a face un lucru simplu, putem folosi:&lt;/p&gt;&lt;p&gt;SELECT DISTINCT TABLE_CATALOG AS [Current Database] FROM INFORMATION_SCHEMA.TABLES&lt;/p&gt;&lt;p&gt;Şi asta are avantajul de a fi ceva mai portabil, pentru că view-urile INFORMATION_SCHEMA fac parte din standardul SQL-92 ... &lt;img src="http://sqlserver.ro/emoticons/emotion-4.gif" alt="Stick out tongue" /&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Răzvan&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;Dar dacă înlocuim DISTINCT cu TOP 1 ?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; &lt;b&gt;&lt;span style="color:blue;"&gt;TOP&lt;/span&gt;
1&lt;/b&gt; TABLE_&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;CATA&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;LOG &lt;span style="color:blue;"&gt;AS&lt;/span&gt;
[Current Database] &lt;span style="color:blue;"&gt;FROM&lt;/span&gt; &lt;span style="color:green;"&gt;INFORMATION_SCHEMA.TABLES &lt;img src="http://sqlserver.ro/emoticons/emotion-42.gif" alt="Confused" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&amp;nbsp;Si o mică (chiar şi mare dacă doriţi) aberaţie:&lt;/p&gt;&lt;p class="MsoNormal"&gt;&amp;nbsp;

&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;DECLARE&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; @v &lt;span style="color:blue;"&gt;TABLE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:gray;"&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TABLE_QUALIFIER &lt;span style="color:blue;"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;255&lt;span style="color:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TABLE_OWNER &lt;span style="color:blue;"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;255&lt;span style="color:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TABLE_NAME &lt;span style="color:blue;"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;255&lt;span style="color:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TABLE_TYPE &lt;span style="color:blue;"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;255&lt;span style="color:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;REMARKS &lt;span style="color:blue;"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;255&lt;span style="color:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;



&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;INSERT&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; &lt;span style="color:blue;"&gt;INTO&lt;/span&gt; @v&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;



&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;EXEC&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt; &lt;span style="color:maroon;"&gt;sp_tables&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; &lt;span style="color:blue;"&gt;TOP&lt;/span&gt;
1 V&lt;span style="color:gray;"&gt;.&lt;/span&gt;TABLE_QUALIFIER &lt;span style="color:blue;"&gt;AS&lt;/span&gt;
DenumireBazaDeDate &lt;span style="color:blue;"&gt;FROM&lt;/span&gt; @v V&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3312.aspx</link><pubDate>Tue, 13 Nov 2007 15:51:29 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3312</guid><dc:creator>xmldeveloper</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3312.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3312</wfw:commentRss><description>&lt;P&gt;-- Just for fun&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;DB_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;database_id&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;FROM&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys.dm_exec_requests &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;WHERE&lt;/FONT&gt;&lt;FONT size=2&gt; session_id&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;@@SPID&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;SELECT&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_ID&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_ID&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_ID&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_ID&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;())))))));&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/P&gt;&lt;/FONT&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3311.aspx</link><pubDate>Tue, 13 Nov 2007 15:35:20 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3311</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3311.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3311</wfw:commentRss><description>Poezie sql de amorul artei ...&lt;br&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3310.aspx</link><pubDate>Tue, 13 Nov 2007 13:12:07 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3310</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3310.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3310</wfw:commentRss><description>&lt;p&gt;Dacă tot vrem metode complicate pentru a face un lucru simplu, putem folosi:&lt;/p&gt;&lt;p&gt;SELECT DISTINCT TABLE_CATALOG AS [Current Database] FROM INFORMATION_SCHEMA.TABLES&lt;/p&gt;&lt;p&gt;Şi asta are avantajul de a fi ceva mai portabil, pentru că view-urile INFORMATION_SCHEMA fac parte din standardul SQL-92 ... &lt;img src="http://sqlserver.ro/emoticons/emotion-4.gif" alt="Stick out tongue" /&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Răzvan&lt;/p&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3309.aspx</link><pubDate>Tue, 13 Nov 2007 13:11:26 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3309</guid><dc:creator>katalyn</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3309.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3309</wfw:commentRss><description>SELECT dbid,DB_NAME(dbid) AS CurrentDatabase FROM master..sysprocesses WHERE spid=@@SPID&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Cătălin&lt;BR&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3308.aspx</link><pubDate>Tue, 13 Nov 2007 12:07:51 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3308</guid><dc:creator>xmldeveloper</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3308.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3308</wfw:commentRss><description>&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;img src="http://sqlserver.ro/emoticons/emotion-2.gif" alt="Big Smile" /&gt;&lt;/P&gt;
&lt;P&gt;-- Useless code &lt;/P&gt;
&lt;P&gt;-- SELECT DB_NAME() is enough&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SELECT&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_NAME&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_ID&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;())&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AS&lt;/FONT&gt;&lt;FONT size=2&gt; [Current Database]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;GO&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;SELECT&lt;/FONT&gt;&lt;FONT size=2&gt; [name] &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AS&lt;/FONT&gt;&lt;FONT size=2&gt; [Current Database] &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;FROM&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys.databases&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;WHERE&lt;/FONT&gt;&lt;FONT size=2&gt; database_id&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;DB_ID&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;();&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;GO&lt;/P&gt;&lt;/FONT&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3304.aspx</link><pubDate>Tue, 13 Nov 2007 12:00:15 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3304</guid><dc:creator>Abadon83</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3304.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3304</wfw:commentRss><description>mersi mult&lt;br&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3303.aspx</link><pubDate>Tue, 13 Nov 2007 11:45:11 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3303</guid><dc:creator>B_gd_n[ ]Sahlean</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3303.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3303</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Abadon83:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;cum pot afla numele bazei de date curente?&lt;br&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; &lt;span style="color:fuchsia;"&gt;DB_ID&lt;/span&gt;&lt;span style="color:gray;"&gt;()&lt;/span&gt; &lt;span style="color:gray;"&gt;,&lt;/span&gt; &lt;span style="color:fuchsia;"&gt;DB_NAME&lt;/span&gt;&lt;span style="color:gray;"&gt;()&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3302.aspx</link><pubDate>Tue, 13 Nov 2007 11:41:48 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3302</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3302.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3302</wfw:commentRss><description>SELECT DB_NAME()</description></item><item><title>Re: cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3301.aspx</link><pubDate>Tue, 13 Nov 2007 11:40:20 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3301</guid><dc:creator>Diana</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3301.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3301</wfw:commentRss><description>&lt;P&gt;Cauta in script&amp;nbsp;statement-ul USE &amp;lt;database_name&amp;gt;.&lt;/P&gt;
&lt;P&gt;In Enterprise Manager / Management Studio vezi ce afiseaza dropdown - ul "available databases".&lt;/P&gt;</description></item><item><title>cum aflu numele bazei de date curente</title><link>http://sqlserver.ro/forums/thread/3300.aspx</link><pubDate>Tue, 13 Nov 2007 11:24:10 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3300</guid><dc:creator>Abadon83</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3300.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3300</wfw:commentRss><description>cum pot afla numele bazei de date curente?&lt;br&gt;</description></item></channel></rss>