tips & tricks http://blogs.dotnethell.it/DevelopmentPost/ HyperBlogs Professional v.2.0 Cursor http://blogs.dotnethell.it/DevelopmentPost/Post_80680.aspx Thu, 11 Jun 2020 12:26:58 +0100 [b]Edoardo[/b] <div style=""><font face="Trebuchet MS"><div style="font-size: 13.3333px;">Esempio di come usare un cursore:</div><div style="font-size: 13.3333px;"><br></div><div style="font-size: 13.3333px;"><br></div><div style="font-size: 13.3333px;">DECLARE @opttype TABLE (code varchar(100),name varchar(300),systemoid varchar(300),description varchar (500),virtual bit,isdigitalized bit,isexternal bit )</div><div style=""><div style=""><span style="font-size: 13.3333px;"><br></span></div><div style=""><span style="font-size: 13.3333px;"><br></span></div><div style=""><span style="font-size: 13.3333px;">insert into @opttype (Code,Name,SystemOid,Description,Virtual,IsDigitalized,IsExternal) values</span></div><div style=""><span style="font-size: 13.3333px;">('18','internal','test','',0,0,0),</span></div><div style=""><span style="font-size: 13.3333px;">('30','internal','</span><span style="font-size: 13.3333px;">test</span><span style="font-size: 13.3333px;">','',0,0,0),</span></div><div style=""><span style="font-size: 13.3333px;">('80','internal','</span><span style="font-size: 13.3333px;">test</span><span style="font-size: 13.3333px;">','',0,0,0),</span></div><div style=""><span style="font-size: 13.3333px;">('81','internal','</span><span style="font-size: 13.3333px;">test</span><span style="font-size: 13.3333px;">','',0,0,0),</span></div><div style=""><span style="font-size: 13.3333px;">('82','internal','</span><span style="font-size: 13.3333px;">test</span><span style="font-size: 13.3333px;">','',0,0,0)</span></div><div style=""><span style="font-size: 13.3333px;"><br></span></div></div></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">DECLARE @code varchar(100),@name varchar(300),@systemoid varchar(300),@description varchar (500),@virtual bit,@isdigitalized bit,@isexternal bit</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">DECLARE optype_cursor CURSOR FOR&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">SELECT code,name,systemoid,description,virtual,isdigitalized,isexternal FROM @opttype</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">OPEN optype_cursor&nbsp;&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">FETCH NEXT FROM optype_cursor INTO @code, @name, @systemoid, @description, @virtual, @isdigitalized, @isexternal</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">WHILE @@FETCH_STATUS = 0&nbsp;&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">BEGIN&nbsp;&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp; &nbsp; &nbsp; IF NOT EXISTS (SELECT 1 FROM OperationType WHERE Code = @code and SystemOid=@systemoid)</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>BEGIN</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>INSERT INTO OperationType&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>Code,Name,SystemOid,Description,Virtual,IsDigitalized,IsExternal) <span style="white-space:pre"> </span></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>VALUES&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>(@code, @name, @systemoid, @description, @virtual, @isdigitalized, @isexternal);</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>END</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp; &nbsp; &nbsp; FETCH NEXT FROM optype_cursor INTO @code, @name, @systemoid, @description, @virtual, @isdigitalized, @isexternal</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">END&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">CLOSE optype_cursor&nbsp;&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">DEALLOCATE optype_cursor&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div> [b]Edoardo[/b] 0 http://blogs.dotnethell.it/DevelopmentPost/ReadComment_80680.aspx SQLServer Serialize Object to string http://blogs.dotnethell.it/DevelopmentPost/Post_29073.aspx Tue, 23 Jan 2018 12:07:47 +0100 [b]Edoardo[/b] <div class="line number1 index0 alt2" style="background: none white !important; border: 0px !important; margin: 0px !important; outline: 0px !important; padding: 0px 1em !important; vertical-align: baseline !important; line-height: 1.1em !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; box-shadow: none !important;"><code class="csharp keyword" style="background: none !important; border: 0px !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; vertical-align: baseline !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; box-shadow: none !important; display: inline !important; font-size: 12px; white-space: pre;"><font color="#006699" face="Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace"><b>Serialize Object to string</b></font></code></div><div class="line number1 index0 alt2" style="font-family: Consolas, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, Courier, monospace; font-size: 12px; background: none white !important; border: 0px !important; margin: 0px !important; outline: 0px !important; padding: 0px 1em !important; vertical-align: baseline !important; line-height: 1.1em !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; box-shadow: none !important; white-space: pre !important;"><code class="csharp keyword" style="background: none !important; border: 0px !important; margin: 0px !important; font-size: 1em !important; outline: 0px !important; padding: 0px !important; vertical-align: baseline !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, Courier, monospace !important; font-weight: bold !important; direction: ltr !important; box-shadow: none !important; display: inline !important; color: rgb(0, 102, 153) !important;"><br></code></div><div class="line number1 index0 alt2" style="font-family: Consolas, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, Courier, monospace; font-size: 12px; background: none white !important; border: 0px !important; margin: 0px !important; outline: 0px !important; padding: 0px 1em !important; vertical-align: baseline !important; line-height: 1.1em !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; box-shadow: none !important; white-space: pre !important;"><code class="csharp keyword" style="background: none !important; border: 0px !important; margin: 0px !important; font-size: 1em !important; outline: 0px !important; padding: 0px !important; vertical-align: baseline !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, Courier, monospace !important; font-weight: bold !important; direction: ltr !important; box-shadow: none !important; display: inline !important; color: rgb(0, 102, 153) !important;"><br></code></div><div class="line number1 index0 alt2" style="font-family: Consolas, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, Courier, monospace; font-size: 12px; background: none white !important; border: 0px !important; margin: 0px !important; outline: 0px !important; padding: 0px 1em !important; vertical-align: baseline !important; line-height: 1.1em !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; box-shadow: none !important; white-space: pre !important;"><code class="csharp keyword" style="background: none !important; border: 0px !important; margin: 0px !important; font-size: 1em !important; outline: 0px !important; padding: 0px !important; vertical-align: baseline !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, Courier, monospace !important; font-weight: bold !important; direction: ltr !important; box-shadow: none !important; display: inline !important; color: rgb(0, 102, 153) !important;"><br></code></div><div class="line number1 index0 alt2" style="background: none white !important; border: 0px !important; margin: 0px !important; outline: 0px !important; padding: 0px 1em !important; vertical-align: baseline !important; line-height: 1.1em !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; box-shadow: none !important;"><font color="#006699" face="Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace"><span style="font-size: 12px; white-space: pre;"><b> public static string Serialize(object o, Type T) { //this avoids xml document declaration XmlWriterSettings settings = new XmlWriterSettings() { Indent = false, OmitXmlDeclaration = true }; var stream = new MemoryStream(); using (XmlWriter xw = XmlWriter.Create(stream, settings)) { //this avoids xml namespace declaration XmlSerializerNamespaces ns = new XmlSerializerNamespaces( new[] { XmlQualifiedName.Empty }); XmlSerializer x = new XmlSerializer(T, ""); x.Serialize(xw, o, ns); } return Encoding.UTF8.GetString(stream.ToArray()); }</b></span></font></div> [b]Edoardo[/b] 0 http://blogs.dotnethell.it/DevelopmentPost/ReadComment_29073.aspx C# Sql Function Return varchar http://blogs.dotnethell.it/DevelopmentPost/Post_28630.aspx Wed, 10 Jan 2018 10:33:11 +0100 [b]Edoardo[/b] <div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><b>Sql Function Return varchar</b></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">CREATE FUNCTION SchemaName.GetValuesCommaSeparated</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">(</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp; &nbsp;@Id int</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">)</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">RETURNS varchar(100) -- or whatever length you need</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">AS</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">BEGIN</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp; &nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">declare @values as varchar(100)</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">declare @result as varchar(100) =''</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>DECLARE cursorValues CURSOR</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>FOR&nbsp; &nbsp; &nbsp;&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>select T.ColumnName from SchemaName.TableName T&nbsp; where<span style="white-space:pre"> </span>T.ID = @Id</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>--OPEN CURSOR.</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>OPEN&nbsp;</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">cursorValues</span><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>--FETCH THE RECORD INTO THE VARIABLES.</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>FETCH NEXT FROM&nbsp;</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">cursorValues</span><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp;INTO @values&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>--LOOP UNTIL RECORDS ARE AVAILABLE.</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>WHILE (@@FETCH_STATUS = 0)</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>BEGIN</span></font></div><div style=""><span style="white-space: pre; font-size: 13.3333px;"><font face="Trebuchet MS"> </font></span></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>set @result += @values +','<span style="white-space:pre"> </span></span></font></div><div style=""><span style="white-space: pre; font-size: 13.3333px;"><font face="Trebuchet MS"> </font></span></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>FETCH NEXT FROM&nbsp;</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">cursorValues</span><font face="Trebuchet MS"><span style="font-size: 13.3333px;">&nbsp;INTO @values</span></font></div><div style=""><span style="white-space: pre; font-size: 13.3333px;"><font face="Trebuchet MS"> </font></span></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>END</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>--CLOSE THE CURSOR.</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>CLOSE&nbsp;</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">cursorValues</span></div><div style=""><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;"><br></span></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><span style="white-space:pre"> </span>DEALLOCATE&nbsp;</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">cursorValues</span></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">RETURN @result;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">END<span style="white-space:pre"> </span></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">declare @a as varchar(100)</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">set @a = SchemaName.</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">GetValuesCommaSeparated</span><font face="Trebuchet MS"><span style="font-size: 13.3333px;">(5)</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">print @a</span></font></div></div> [b]Edoardo[/b] 0 http://blogs.dotnethell.it/DevelopmentPost/ReadComment_28630.aspx Transact SQL BACKUP DATABASE http://blogs.dotnethell.it/DevelopmentPost/Post_28583.aspx Tue, 09 Jan 2018 11:19:13 +0100 [b]Edoardo[/b] <div style=""><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;"><b>BACKUP AND RESTORE sintax</b></span></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">BACKUP DATABASE [dbname] TO&nbsp; DISK = N'D:\Database\Backup\20180102_dbname.bak' WITH&nbsp; COPY_ONLY, NOFORMAT, INIT,&nbsp; NAME = N'dbname-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,&nbsp; STATS = 10</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">GO</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">declare @backupSetId as int</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">select @backupSetId = position from msdb..backupset where database_name=N'dbname' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N'dbname' )</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">if @backupSetId is null begin raiserror(N'Verify failed. Backup information for database ''dbname'' not found.', 16, 1) end</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">RESTORE VERIFYONLY FROM&nbsp; DISK = N'D:\Database\Backup\20180102_dbname.bak' WITH&nbsp; FILE = @backupSetId,&nbsp; NOUNLOAD,&nbsp; NOREWIND</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">GO</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><div style=""><span style="font-size: 13.3333px;"><br></span></div><div style=""><span style="font-size: 13.3333px;">RESTORE DATABASE [dbname] FROM&nbsp; DISK = N'D:\MSSQLSERVER\20180102\20180102_dbname.bak' WITH&nbsp; FILE = 1,&nbsp;&nbsp;</span></div><div style=""><span style="font-size: 13.3333px;"><br></span></div><div style=""><span style="font-size: 13.3333px;">MOVE N'dbname' TO N'D:\Database\DATA\dbname.mdf',&nbsp;&nbsp;</span></div><div style=""><span style="font-size: 13.3333px;"><br></span></div><div style=""><span style="font-size: 13.3333px;">MOVE N'dbname_log' TO N'D:\Database\DATA\dbname.LDF',&nbsp; NOUNLOAD,&nbsp; REPLACE,&nbsp; STATS = 10</span></div><div style=""><span style="font-size: 13.3333px;"><br></span></div><div style=""><span style="font-size: 13.3333px;">GO</span></div><div style="font-size: 13.3333px;"><br></div></font></div> [b]Edoardo[/b] 0 http://blogs.dotnethell.it/DevelopmentPost/ReadComment_28583.aspx SQLServer Install Util http://blogs.dotnethell.it/DevelopmentPost/Post_28307.aspx Tue, 02 Jan 2018 14:45:43 +0100 [b]Edoardo[/b] <div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><b>Installare un servizio Windows</b></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">installutil&nbsp; /ServiceName="Service_Test"&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">"C:\Program Files\Test\Services\Service.exe"</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;"><br></span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">installutil /u /ServiceName="</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">Service_Test</span><font face="Trebuchet MS"><span style="font-size: 13.3333px;">"&nbsp;</span></font></div><div style=""><font face="Trebuchet MS"><span style="font-size: 13.3333px;">"</span></font><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 13.3333px;">C:\Program Files\Test\Services\Service.exe</span><font face="Trebuchet MS"><span style="font-size: 13.3333px;">"</span></font></div> [b]Edoardo[/b] 0 http://blogs.dotnethell.it/DevelopmentPost/ReadComment_28307.aspx Command