Help Complete This CLR Code?
May 3, 2006
Using the tutorial at:
http://msdn2.microsoft.com/en-us/library/ms131094.aspx
I've determined that the code I need to follow is:
Imports System
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlClient
'The Partial modifier is only required on one class definition per project.
Partial Public Class StoredProcedures
''' <summary>
''' Create a result set on the fly and send it to the client.
''' </summary>
<Microsoft.SqlServer.Server.SqlProcedure> _
Public Shared Sub SendTransientResultSet()
' Create a record object that represents an individual row, including it's metadata.
Dim record As New SqlDataRecord(New SqlMetaData("stringcol", SqlDbType.NVarChar, 128) )
' Populate the record.
record.SetSqlString(0, "Hello World!")
' Send the record to the client.
SqlContext.Pipe.Send(record)
End Sub
End Class
Given this code, how do I add other SqlMetaData Columns to the statement:
Dim record As New SqlDataRecord(New SqlMetaData("stringcol", SqlDbType.NVarChar, 128) )
---
Like this???
Dim record As New SqlDataRecord(New SqlMetaData("stringcol", SqlDbType.NVarChar, 128),New SqlMetaData("otherstringcol", SqlDbType.NVarChar, 128) )
I assume
record.SetSqlString(0, "Hello World!")
record.SetSqlString(1, "I'm Here!")
To populate the data.
Thanks,
-David
View 1 Replies
ADVERTISEMENT
Apr 14, 2008
What can I do to make OnComplete and OnSuccess mean something in SQL Server 2000 DTS?I have this pretty simple package that imports data into a table from an XLS file, then runs an external console application which manipulates the data and drops into a different table.That data is then used to create a CSV file. If I execute each step individually, the whole thing works. But what it happening is that the end file is being created before the console app is finished.I have a workflow line (on complete) between the 2 processes, but that doesn't seem to mean anything. To run the external app I am just using an active x script task...CreateObject("WScript.Shell").Run "my file" Any advice?
View 1 Replies
View Related
Apr 9, 2001
Dear all,
I have a SQL Server 7 box that is shortly to be rebuilt completely (still on NT4, but with new RAID system), does anyone have any advice on how I can make the transition as painless as possible? Particularly, I want to maintain the backup, security and DTS structures as much as possible.
Thanks in advance
Jonathan
View 1 Replies
View Related
Jun 15, 2006
how can i copy a complete database (tables, views, stored procedures) with/in the sql server 2005 "server mgm. studio". the import/ export function only copys the data (tables).
sql server 2000 had a nice tool for that (import/ export data). but how can i do that with the sql server 2005. can't find anything ...
View 3 Replies
View Related
Mar 26, 2003
Hi all - I'm having problems getting a package to run successfully to completion when I schedule it in SQL Server or as a batch file on the Windows scheduler. If I run the package interactively or run the batch file interactively that contains the DTSRUN command it runs to completion. Both packages start with a call to a batch file that FTPs files from a remote server and then they continue on by executing additional DTS packages within the running package. The owner of all the packages involved and is the same user that I am logged in as when running the packages interactively and is the same user that that SQL Agent and the Windows scheduler job runs under. The FTP step of each package does complete successfully but then I cannot trace where the package then hangs. The package never fails but rather it just continues in a Executing/Running state. This is getting extremely frustrating. Any insight in to this problem would be greatly appreciate.
View 4 Replies
View Related
Feb 18, 2002
Hello.
I have a delete statement that works on some servers/databases and not on others. I am running this on SQL Server 2000/Windows 2000. The statment is a very simple DELETE x FROM y WHERE x = 1234. It is only 1 record in one table. The staement begins but never completes. It looks as if it just keeps trying to recompile but goes nowhere. Have any of you ever seen this before? It works on a restore of the database on 1 server, but not on another. It will not run on either production server/database. Is there a parameter or setting that I need to look for that might be different and causing this? I am running the Enterprise edition of SQL Server on some servers, and standard edition on others. Would that make a difference? If so, how and why. I've never had this issue before. We are running Windows Advanced Server on most all of our servers.
Any help on this would be greatly appreciated.
Thanks.
Deanna
View 6 Replies
View Related
Nov 7, 2000
We are running SQL 6.5 sp5a. There have been a number of instances recently where some scheduled tasks don't complete. I can't even cancel them. The only way to stop them is to stop and start the Executive service.
Anyone come across this before and know what the problem is?
View 1 Replies
View Related
Aug 31, 2004
Hi,
I am having trouble trying to import a big file (aprox 250Mb is size) into an SQL Server database and I keep getting the message:
"Not enough storage is available to complete this operation".
The application tries to import the file by executing a stored procedure:
CREATE PROCEDURE sp_updateMaterialBlob
@MaterialId Int,
@BLOB image
AS
BEGIN
Update Material SET blob = @blob where id = @materialId
END
The application uses an ADO connection. I've tried increasing the memory of the client machine but that didn't work. Whenever I do run the import, nearly all the memory on the machine is used up but every time after several hours I get the same error message. What is the cause of the problem and how do I resolve it? Ideally I want to use my application to do the import rather than anything bespoke.
View 7 Replies
View Related
Dec 15, 2005
I was given the task of writing a new website for my boss.
problem being he wants the ability have a custom user signup form and then a picture gallery of service with comments listed off each one.
I was also asked to produce this in .aspx with SQL.
only one small glitch, never worked with either of them....
I have designed most of the database requirements off of examples I found online but have not found how to post data from the users signup form to the database correctly and retrieve it for the customers profile.
any suggestions????
all help on this will be greatly appreciated
View 9 Replies
View Related
Nov 22, 2007
Hello all! A while ago I started cataloging my collection of old radio recordings and I wrote a simple Visual Basic 2005 program to display them in a nice UI. I have implemented an SQL database with the project and all is fine, when I run the program it connects to the sql server and downloads the data. But when I try and change something by connecting from within Visual Basic at runtime with this code:
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
Dim ConnectionString As New SqlConnection("Server=MARK-HOMESQLEXPRESS;Database=Library.mdf;Uid=MARK-HOMEMark;Pwd=sodoff;")
Dim sqlString As String
ConnectionString.Open()
sqlString = "UPDATE JackBenny SET Rating='Excellent' WHERE [Episode Number]=" & epNumber
ConnectionString.BeginTransaction(sqlString)
ConnectionString.Close()
End Sub
I get this error code in the log and a general unable to login error within Visual basic itself:
2007-11-22 15:44:39.78 Logon Error: 18456, Severity: 14, State: 5.
2007-11-22 15:44:39.78 Logon Login failed for user 'Mark'. [CLIENT: <local machine>
The state of 5 refers to "User ID is not valid." but I can login to SQL Server Management Studio Express just fine with the username and password in the code posted. Also of note, I can login to the Server Managment with the sa account username and password. When I use the credentials in visual basic code, same error. Any ideas? I am trying to connect to a database which is on this computer (local) in the root folder of the application, called Library.mdg.
Thanks so much all
View 7 Replies
View Related
May 8, 2006
I recently re-built my entire system from ground up (new hard drives, OS, etc). I now have the problem of SQL 2005 installed partially, but no way to get the management tools installed. I get an "already installed message when I try". I've never encounted this before on any other SQL install.
Sequence of events. I installed VS 2005 Pro first, then followed by SQL 2005. Somewhere this install didn't work, and I was left with the MS installed thinking I suceeded, yet none of the functions of SQL were worked or more importantly accessable.
I tried to re-install after using the ADD/Remove App from the control panel (which was sucessfull). SQL thought it was still installed. So I uninstalled VS 2005 as well, and deleted any programs in the SQL directory. Then I checked ADD/Remove programs and nothing was showing. The re-install still did not work. My guess is that the registry is still loaded with now useless entries.
Is there any solution left that does not require me to hand delete any SQL registry entries, since that is always a great way to completely kill my system.
Thanks.
View 1 Replies
View Related
Nov 12, 2007
Hi,
How can I encrypt / decrypt whole database (data, objects ... everything) in SQL Server 2005 Express Edition?
Quick solution from any champion of Databases would be highly entertained.
Waiting ..
Thanks a lot.
View 4 Replies
View Related
Oct 26, 2006
I get this exception after awhile of browsing thru my application, i dunno what causes this because it never happens in the same place. I would like to know if anyone else is experiencing this situation and if there is a solution.
SqlCeException
Not enough storage is available to complete this operation.
em System.Data.SqlServerCe.SqlCeConnection.ProcessResults()
em System.Data.SqlServerCe.SqlCeConnection.Open()
em System.Data.SqlServerCe.SqlCeConnection.Open()
em System.Data.Common.DbDataAdapter.QuietOpen()
em System.Data.Common.DbDataAdapter.FillInternal()
em System.Data.Common.DbDataAdapter.Fill()
em System.Data.Common.DbDataAdapter.Fill()
View 9 Replies
View Related
Apr 26, 2008
My requirement is something like this
I get department ,salary as input from a stored procedure .
now i have to select all the employee no's from the department table.
and based on that i have to select all the employee details from employee table whose salary is greater than given salary.
and the complete row should be passed as output parameter.
This cursor is fine
create procedure usp_proc (@dept char(10),@sal decimal (10,2),@emplist cursor varying output)
declare @empid int
DECLARE @getempid CURSOR
SET @getempid = CURSOR FOR
SELECT emp_id
FROM department where dname = @dept
OPEN @getAempid
FETCH NEXT
FROM @getempid INTO @empid
WHILE @@FETCH_STATUS = 0
BEGIN
select ename,dept,dob,doj,status,pos,sal from employee where empno = @emp_id
FETCH NEXT
FROM @getempid INTO @empid
END
CLOSE @getempid
DEALLOCATE @getempid
I am getting the complete row displayed as output .
How do i redirect the output to the declared output is my concern.
View 8 Replies
View Related
Oct 26, 2006
Hello,
I want to truncate all tables present in the particular database, Is there any simple way to do it? or do I have to do it on individula basis (table by table)?
regards
View 4 Replies
View Related
Nov 30, 2005
Product: Microsoft SQL Server Native Client -- Error 1706. An installation package for the product Microsoft SQL Server Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'.
View 16 Replies
View Related
Feb 8, 2008
I'm in a db design, implement, and mgmt class this semester and we are teaching ourselves SQL using MS SQL 2005. I downloaded and installed MS SQL Server 05 Std version successfully. However, when I open the Server Mgmt Studio I am prompted to connect to a server??
EX:
Server Type: Database Engine
Server Name:?????????
Windows Authentication
To my knowledge we have been given no server info and are only supposed to be learning the language. Can I just cancel this window and continue?
The only help we have been given is a O Reilly: Learning SQL on SQL Server 2005 and they kind of skip all the installation and setup stages.
I should probably mention that I'm using Vista.
View 6 Replies
View Related
May 9, 2008
A couple of days ago I installed SQL Server 2005 developer. To pave the way for this I removed SQL Server 2000 and 2005 Express. Since then I've been unable to connect from any of my applications or websites in Visual Studio 2005 to either:- my new 2005 Developer database engine- my colleagues 2005 developer database engine. My colleague can connect to my databases from his visual studio on his machine. I am receiving unspecified OleDb errors.Anyone else had this happen? Anyone know where I should start looking? I've uninstalled all .Net frameworks and re-installed 1.1 and 2.0.Many thanks, Sam
View 3 Replies
View Related
Oct 27, 1999
"Database in use. The system administrator must have exclusive use of the database to run the restore operation." I created a script in the 7.0 database to reconfig the db to 'dbo use only' and identify and then kill all but the 'SA' and 'NT AUTHORITYSYSTEM' processes but that still is not enough. Can anyone please tell me what I'm missing here?
Thanx.
W.
View 1 Replies
View Related
Nov 28, 2006
i have an aplication with any problems, the aplication is hang and in the log is
SQL Server has encountered 1 occurrence(s) of IO requests taking longer than 15 seconds to complete on file [d:Program FilesMicrosoft SQL ServerMSSQLdata empdb.mdf] in database [tempdb] (2). The OS file handle is 0x000003DC. The offset of the latest long IO is: 0x00000016930000 and the aplication log is
E R R: [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionWrite (WrapperWrite()). NUMERO -2147467259 FUENTE Microsoft OLE DB Provider for ODBC Drivers
can yu help me
View 4 Replies
View Related
Aug 6, 2014
I am running an update query.It is taking long time. To find the estimated completion time i checked sys.dm_exec_request or sys.dm_exec_session or sp_who2 but there is no clue. It is showing as zero.
View 3 Replies
View Related
Oct 11, 2007
in 2005..
I want to script the whole database - is this possible?
I'd like to see the same scripts that I get when in management studio I right click on a table and do script table as - create to
is there anyway to get in one click all the tables or do I need to do one by one?
View 2 Replies
View Related
Mar 8, 2007
I'm getting the "out of memory" exception when trying to do various things on a sql mobile [sql mobile 2005] database on a windows mobile 5 device. Our app uses compact framework 2.0 and is written in c#.
Our application uses strongly typed data sets, and save/loads them from a sql mobile database. The error occurs in different places, but always somewhere we interact with the database. It might fail on "DELETE FROM Location" in one run, and on a DataAdapter.Update on another, and a DataAdapter.Fill in another.
The memory thing I can add to the today screen suggests that when I encounter this error there is only 1-2Mb of program memory free [and about 13Mb of storage]. Unfortunately windows mobile 5 doesn't seem to have a way to adjust the allocation between storage/program memory anymore.
The failure has been occuring while trying to import data [which we are loading from a web service, as weakly typed datasets and copying into our specialized ones].
I have implemented:
Using statements, and/or dispose statements on:
Data Adapters
explicitly calling the dispose method on commands used in data adapters: http://support.microsoft.com/kb/824462
Sql Connections
Sql commands [where not used in adapters]
Using/dispose around the larger data sets in the loading process
Gc.Collect() before database interaction [this seemed kind of like a last resort]
Reduction of memory usage [by loading fewer records from the web service at a time]
There does not seem to be a storage memory limitation, a fully loaded database file is about 3Mb. Our test handheld has only 64Mb of memory, and I've seen at most maybe 25Mb free [storage and program combined].
We are opening [and closing] a connection each time we touch the database. How much of a difference will going to a single connection opened when the app starts make?
Any ideas? Perhaps there's something I've missed?
thanks,
-Stair Counter
View 13 Replies
View Related
Apr 8, 2008
Hello I recently bought a Palm Centro from Sprint and I wanted to install the cd that came with it. On this cd is Palm desktop and Sprint music manager which I need to use my phone. The problem is when I insert the disk. After my laptop reads it it displays the error message along with: Line:134 Char:2 Code:0 and finally URL: file://E:EnglishEssential_Software
esources.html. I have no idea what to do or why this is happening can you please explain????? Maybe offer some steps also thank you
View 1 Replies
View Related
Apr 13, 2007
Hello,
I most likely am being incredibly stupid here, but I have installed SQL 2005 Enterprise and Service Pack 2 on my Acer laptop running Vista Business and cannot for the life of me figure out how to start the thing.
When I hit the start button on the toolbar, and go to Microsoft SQL Server 2005, there is one folder that expands down called Configuration Tools. This has the options Notification Services, Configuration Management, Error and Usage Reports, and Surface Area Configuration. But no where can I find an icon that actually starts the database thing so I can create a database and learn some SQL stuff.
I would be most grateful if anybody could point out where I am going wrong or if there is anything I need to do.
Many thanks,
Chima
View 3 Replies
View Related
Nov 1, 2007
I want to poll a row on a table:
DECLARE @CNT INT
DECLARE @Q NVARCHAR(1000)
SET @CNT = 1
WHILE(@CNT < 1000)
BEGIN
SET @Q = 'SELECT * FROM table'
PRINT @Q
EXEC sp_executesql @Q
SET @CNT = @CNT + 10
WAITFOR DELAY '00:00:01'
END
The thing is I want it just to run and run in a separate window, while something else is updating this table.
Thing is: it seems to run right to the end and only then produce output.
My question is: how can I get it to print output as it happens, rather than when the script is complete?
View 1 Replies
View Related
Jan 31, 2008
I have a service (Windows service that is) that's set to automatic startup. The service makes use of one or more SQL server databases and is configured with a startup dependency on SQL Server.
Problem is, the service control manager considers that startup dependency to be satisfied once the SQL server service process successfully starts, but connections from within my service to my databases won't actually succeed until recovery on at least those databases is complete.
Of course, I can do something mundane like retry failed connections a few times, or ensure that I don't attempt to connect to a database until some hard-wired amount of system uptime has passed, but those solutions are just band-aids. The Right Answer, it seems to me, would be to detect when SQL Server has finished recovery and not attempt to connect to my databases before that time.
So, is there any way to determine if SQL server has completed recovery programatically? On a server-wide basis or on an individual database basis? I'm assuming that my service would need to connect to SQL Server with some high-powered credentials (sa or equivalent) to get that information, but that's not a problem in my application.
Any pointers appreciated!
View 5 Replies
View Related
May 12, 2006
Does anyone know where to obtain a complete list of error codes which can occur in SQL Server ? For example : errror number 547 is a foreign key violation - where can I get a complete list of these numbers and there descritions ?
I can't find it in BOL or anywhere
View 1 Replies
View Related
Jul 27, 2006
Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value
for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next
Main = DTSTaskExecResult_Success
End Function
This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)
Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:
public Sub Main()
...
Dts.TaskResult = Dts.Results.Success
End Class
I get the following error when I attempt to compile this:
Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.
I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.
- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).
Given this statement:
dim cn, i, rs, sSQL
I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!
View 7 Replies
View Related
Mar 28, 2007
Dear Friends,
I am having 2 Tables.
Table 1: AddressBook
Fields --> User Name, Address, CountryCode
Table 2: Country
Fields --> Country Code, Country Name
Step 1 : I have created a Cube with these two tables using SSAS.
Step 2 : I have created a report in SSRS showing Address list.
The Column in the report are User Name, Address, Country Name
But I have no idea, how to convert this Country Code to Country name.
I am generating the report using the Layout tab. ( Data | Layout | Preview ) Report1.rdl [Design]
Anyone help me to solve this issue. Because, in our project most of the transaction tables have Code and Code description in master table. I need to convert all code into corresponding description in all my reports.
Thanks in advance.
Regards
Ramakrishnan
Singapore
28 March 2007
View 4 Replies
View Related
Feb 11, 1999
Hello:
We are running some test on our application which involves long-running transaction in an application that was purchased from a vendor. It is a PB
and we don't have access to all of the code. We are not sure why it runs so slow when we start this long_running process. We are not sure if they are using a stored procedure or not.
We ran updaet statistics becuase alot of data was added before we kicked off the process. We want to capture all of the sql code that is running so we can perhaps add indices.
Under EM, we click on the thread and can get a dialog box that shows the running sql code but the dialog box isn't expandable
THerefore I am wondering if there is a storec provedure or if someone has a script, to see what the complete text of sql is for a running proess? Any shareware tools?
Any information that you can provide will be appreciated. Thanks.
David Spaisman
View 2 Replies
View Related