Books online mention the existence of sample code for several custom tasks, including the one mentioned in the title. But, when I try to find this code in the location mentioned it is nowhere to be found.
I have run a search on the rest of my drive and come up empty.
Does anyone have any sample code for using ntext data type, when inserting or reading big block of texts? How can you read a big huge block of text back into c#?
This is a sample code from an MSDN help site. I copied it and pasted into an open new query. I tried to execute it and got two errors:
USE AdventureWorks; GO DECLARE @tablename sysname SET @tablename = N'Person.AddressType' table_loop: IF (@@FETCH_STATUS <> -2) BEGIN SELECT @tablename = RTRIM(UPPER(@tablename)) EXEC ('SELECT ''' + @tablename + ''' = COUNT(*) FROM ' + @tablename ) PRINT ' ' END FETCH NEXT FROM tnames_cursor INTO @tablename IF (@@FETCH_STATUS <> -1) GOTO table_loop GO
The errors are:
Msg 208, Level 16, State 1, Line 1 Invalid object name 'PERSON.ADDRESSTYPE'.
Msg 16916, Level 16, State 1, Line 9 A cursor with the name 'tnames_cursor' does not exist
The database is connected. Table Person.AddressType is a part of it.
hi, i learn by practice and i would like an asp code using c# that connects to sql database can retrives information from a table. can you please copy paste me some code or give me exact link a?
I was thinking of using a CTE to return history, have you ever done this?
I know this can be done in other ways but I wanted to wrap this CTE in a view so people could join to it.
Here is an example table: KEY ASOFDATE A 1/1/2007 A 3/1/2007 B 1/1/2007 B 2/5/2007 B 3/6/2007
I want the results to look like: KEY START END A 1/1/2007 3/1/2007 A 3/1/2007 NULL B 1/1/2007 2/5/2007 B 2/5/2007 3/6/2007 B 3/6/2007 NULL
This would be even better:
ID KEY ASOFDATE 1 A 1/1/2007 2 A 3/1/2007 3 B 1/1/2007 4 B 2/5/2007 5 B 3/6/2007
I want the results to look like: ID KEY START END 1 A 1/1/2007 3/1/2007 2 A 3/1/2007 NULL 3 B 1/1/2007 2/5/2007 4 B 2/5/2007 3/6/2007 5 B 3/6/2007 NULL
If somebody have worked on providing the code for the selection of delivery method and delivery schedule page in aspx . Then please share it with me. I am working on creating a Subscription page using aspx rather then reporting services page.
Please let me know if there are any controls provided by reporting services or some 3rd party for this.
I am new to sql server express editions. starter kits and Sample applications link provided in the sites are not working. Can anyone provide me the alternate link where I can dwnld them from
Does anyone know where to find a simple sample showing you how to use asp.net 2.0 with the login control to direct you to another aspx page using SQL 2000 as the database on a hosted server? I have been beating my head against the wall trying to figure this out and would be very appreciative if anyone knows a place out there that shows this? I can find many sites that show you how to do this with SQL 2005, but not SQL 2000. Thanks - Chris
I am trying to write a ssis surrogate key data transform, my problem is I can't find an example how to add a column to the incoming columns and add some data to it. If anyone has a sample, can you please post it. I found a script option that works but I would like an actual transform.
I am looking for some examples of code for an appliction which will let run RS reports from a custom application. The user will choose the reports from a menu structure
We have an exiting application which we use to run crystal reports which we are going to be migrating to RS. We use custom web controls to capture the required parameter values for the reports, and hope to reuse the same controls (with minimal rework) to capture the parameters values for the RS reports.
What I am after is some code which will
a) let me run the report and display it. I don't want to display the report parameters in the URL etc as we generate some report parameter values based upon the user's ID and do NOT want them displayed back to the users
b) export the report to PDF, CSV etc depending upon the option chosen by the user.
The application will be developed in VS 2005 - VB. Does any one know of some links to some sample code
Hi, there; I try to import data from ODBC using C# programmatically. Is there any sample code we can have a look. Like how to read schema from ODBC source table and then create source column...
I have been developing VBA apps in Access and Excel for sometime and am fairly proficient in VBA. Now we are moving all of our data to SQL Server 2005. I am in need of learning how to write code for the Script Component of a data flow task. And so I have a couple of questions.
First, are there any books you recommend for learning ???? (I'm not even sure what I need to learn: .NET? ADO.NET?)
And as a follow-up, any good websites that provide good reference documentation?
And my second question is more specific to my current problem. If I had a bit of code to get me started, I'm sure I could scream all the way to the bottom of the hill.
Data source is coming from a sort task where the data is sorted by STATUS and then MOD_DATE and the AUDIT_ID. I need to read each row and compare it to the next row. If STATUS is the same, discard the second row. When STATUS is different, send the first row to the output (to be used by the next task in the data flow). Using the "different" row from step 3, go to step 2.
I know how to write if statements, case statements, for/next statements. I'm just not understanding how to read the rows in and then send them back out. I've been searching for some sample code but everything I find tends to be solving much bigger issues.
Any help you can provide would be much appreciated.
In the "Example: Detecting a Poison Message" section, it reads: This Transact-SQL example shows a simple, stateless service that includes logic for handling poison messages. Before the stored procedure receives a message, the procedure saves the transaction. When the procedure cannot process a message, the procedure rolls the transaction back to the save point. The partial rollback returns the message to the queue while continuing to hold a lock on the conversation group for the message.
Is there any sample code to demo the SSB send messages with same sql instance?
my case is very simple:
I want write a stored procedure to send a xml to another database. The stored procedure is called by tables triggers when some data is changed under the specific conditions.
I'm working with the April CTP of SQL Server and I'm trying to create a proof of concept using service broker. I'm struggling with the "abc's" of it. If anyone has or can point me to a distributed "Hello, World" for service broker between SQL Server 2005 and SQL Express instances it would save me some time and trouble.
How to upload excel data to sql server 2000 thorugh .net application. I want like one upload button should be there,we have to browese corresponding excel file and then we need to upload to database. before uploading it has to ask appending or replace everything in table. both options appending and replacing shoulb be there. How to upload ? any sample code is there plz give me.
After much work and thanks to all of you who helped on this here is a code sample that can be adapted. From the dataflow task add an OLEDB source component, a row count component and finally a Script Destination Component.
On the Script Destination Component rename the Input node of the imports and outputs tree view to "ParsedInput"
The readonly User: variables that start with gs can be read in the PreExecute method
The readwrite User: variable giSuccessCount can only be used in the post execute task because it is populated by the Row Count Component which is the previous object in the Dataflow
The xml code is adapted from an idea in Donald Farmers book
enjoy
Dave
Now if someone can make a Script Source Component that can read a file with a header , data body and trailer that would b egreat! ' Microsoft SQL Server Integration Services user script component ' This is your new script component in Microsoft Visual Basic .NET ' ScriptMain is the entrypoint class for script components
Public Class ScriptMain Inherits UserComponent Dim sw As StreamWriter 'In addition to using the Imports System.Xml statement a reference must be added to the 'System.Xml assembly (Select Project-Add Reference from IDE) Dim xWriter As XmlTextWriter Dim OutputFileType As String '.csv or .xml
Public Overrides Sub PreExecute()
'Read Only variables Dim gsPickUp As String = Me.Variables.gsPickUp 'D:ftprootOutAvid' Dim gsPickUpFilename As String = Me.Variables.gsPickUpFilename '1_AVID_' Dim gsPickUpFileExtn As String = Me.Variables.gsPickUpFileExtn '.csv' Dim gsMemoText As String = Me.Variables.gsMemoText 'Memo Text : credit adjustment' Dim gsStatementText As String = Me.Variables.gsStatementText 'Statment Text : credit adjustment' Dim gsRunMode As String = Me.Variables.gsRunMode 'UPDATE' Dim fileName As String = gsPickUp & "" & gsPickUpFilename fileName = fileName & (Format(Now(), "yyMMdd").ToString) 'MsgBox(fileName)
OutputFileType = gsPickUpFileExtn If OutputFileType = ".csv" Then fileName = fileName & gsPickUpFileExtn sw = New StreamWriter(fileName) 'connection to dest file
'Header records sw.Write(gsRunMode) sw.Write(Environment.NewLine) ' end of line sw.Write(gsMemoText) sw.Write(Environment.NewLine) sw.Write(gsStatementText) sw.Write(Environment.NewLine) sw.Write(Environment.NewLine) 'Spacer End If
If OutputFileType = ".xml" Then fileName = fileName & gsPickUpFileExtn 'xWriter = New XmlTextWriter(Me.Connections.XMLConnection.ConnectionString, Nothing) 'xWriter.WriteStartDocument() 'xWriter.WriteComment("Customer file parsed using script") 'xWriter.WriteStartElement("x", "customer", "http://some.org/name") 'xWriter.WriteAttributeString("FileName", Me.Connections.XMLConnection.ConnectionString) xWriter = New XmlTextWriter(fileName, Nothing) xWriter.WriteStartDocument() xWriter.WriteComment("Customer file parsed using script") xWriter.WriteStartElement("x", "customer", "http://some.org/name") xWriter.WriteAttributeString("FileName", fileName) End If
End Sub
Public Overrides Sub ParsedInput_ProcessInputRow(ByVal Row As ParsedInputBuffer)
If OutputFileType = ".csv" Then Dim delim As String = ","
If OutputFileType = ".csv" Then 'Create the trailer sw.Write(Environment.NewLine) ' blank line sw.Write("RECORD_COUNT: " & Me.Variables.giSuccessCount.ToString) 'ReadWrite Varible sw.Write(Environment.NewLine) sw.Flush() 'send the stream to file 'Close file sw.Close() End If
If OutputFileType = ".xml" Then xWriter.WriteStartElement("RecordCount") xWriter.WriteString(Me.Variables.giSuccessCount.ToString) xWriter.WriteEndElement() xWriter.WriteEndElement()
hi allin the sample of sqlserver2005(notification service(stock))this is code sample in :appADF.xml(stock) -------------------------- -- Update value in the chronicle if event price greater than value in the chronicle UPDATE StockEventsChron SET StockPrice = E.StockPrice FROM StockEvents E, StockEventsChron C WHERE E.StockSymbol = C.StockSymbol AND E.StockPrice > C.StockPrice.for scenario: + the first SubscriberId(Stephanie) set :StockTriggerValue=20, and stockPrice changge =50 -> one notification for Stephanie and in the table StockEventsChron the value field :StockPrice = 50, + the next : stockPrice changge = 25. the field value StockPrice of table StockEventsChron is still 50 + then second SubscriberId(Scott) set StockTriggerValue=30 but---------------- Insert Into StockNotifications ( S.SubscriberId, S.DeviceName, S.SubscriberLocale, E.StockSymbol, E.StockPrice ) SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, E.StockSymbol, E.StockPrice FROM StockSubscriptions S JOIN StockEvents E ON S.StockSymbol = E.StockSymbol LEFT OUTER JOIN StockEventsChron c ON S.StockSymbol = c.StockSymbol WHERE S.StockTriggerValue <= E.StockPrice AND (S.StockTriggerValue > c.StockPrice OR c.StockPrice IS NULL) here :StockTriggerValue=30 < c.StockPrice=50 so no notification for Scott, why ?can anyone help me?
Does anybody have a working Java code sample that connects to an SQLServer 2005 database on a remote host, via the default named pipe, from a client using the SQLServer 2005 JDBC driver? Could you post it, or a pointer to it?
I've gotten java.sql DriverManager.getConnection() to work fine with TCP/IP connections before. But I'm a newbie with named pipes, and unclear on how the connection string/properties are different. I've tried to piece it together from multiple docs and threads, but haven't found sample code that quite fits my situation. I think a simple working example would best clarify the syntax.
The server is not using SQL Express. Most SQLServer configuration options are defaults; the named pipes protocol is enabled.
In a messaging application, a client sends a message to the server. The server uses Service Broker Interface, and is CLR based. On the server, the message has a life cycle - going throughout multiple transitions until is final (Pending, In Transit, Delivered, TimedOut, Undeliverable). As the server receives the message, it sends back to the client a reply status message of In Transit. It does so using the same message€™s conversation. It also saves €“ along with the message €“ its conversation handle. The dialog is not closed. After a while, the server may decide that the message has gotten to a final state (Delivered or TimedOut). I would like at that time to send a reply status message (Final State) back to the client and also close the conversation. The conversation handle has been saved by both, client and server. Having the conversation handle available - how do I get back to the client later on? Thanks,
I have installed SQL Server Management Studio 2005 and have beenfinding the equivalent of the Data Transfer Services in SQLServer2000. I think I have worked out that it is in SQL Server IntegrationServices but when I open File-New-Project I do not see the SQL ServerIntegration Services there, though Help assumes that it is availablefor selection when starting a new project..How can I make it visible in the New Project window?I have successfully used the import function so I think this meansthat Inegration Services is there somewhere.I would appreciate some advice,Best wishes, John Morgan
I have a report in reporting services that has a bookmark value asigned to each row. In the following Page_Load event for the page, I'm getting the following error on the ReportViewer1.JumpToBookmark("6") statement:
"An exception of type 'System.InvalidOperationException' occurred in Microsoft.ReportViewer.WebForms.dll but was not handled in user code
Additional information: Some parameters or credentials have not been specified"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim strReport1 As String = "/ReportDirectory/CurrentWeekSales"
ReportViewer1.ServerReport.ReportServerUrl = New System.Uri(CStr(Session.Item("ReportServer"))) ReportViewer1.ServerReport.ReportPath = strReport1 ReportViewer1.ServerReport.Timeout = 500000
Do While ReportViewer1.ServerReport.IsDrillthroughReport ReportViewer1.PerformBack() Loop
Dim RptParameters1 As ReportParameter() = New ReportParameter(0) {} RptParameters1(0) = New ReportParameter("EBO_EmpKey", CStr(Session.Item("UserKey"))) ReportViewer1.ServerReport.SetParameters(RptParameters1)
Through SharePoint you can upload an RDS file and then click manage data sources to hook upthe report to a proper shared data source. Does anyone know if you can do this through the SharePoint object model? We don't deploy our reports using the designer and we don't want to upload the reports using SharePoint. We want to add the reports to a document library using the object model, when we do this we need to manage the data source so that it will run.
I have a custom assembly which has a strong name, and I have deployed it in the GAC. I have also raised its trust level to Full Trust.
I have added a reference to this assembly from report properties.
when I try to use it, I get the error
[BC30451] name 'myUtil' is not declared.
Here myUtil is the instance name of the my class. (All methods are instance methods in my class and there are no static methods).
I found many people facing this issue, and the solution involved copying of the assembly in some privateassemblies folder. However that should not be the case with me as I have the assembly in the GAC.
My MSSQL service cannot start !!! The other ones start normally, but MSSQL goes from stopped trough enabling and back to stopped. Nothing works !!! I'm really desperate. Note that the same thing happenes with MySQL. BTW, my machine: AMD Athlon XP 1700+ 256 MB RAM Windows XP with SP1 and some critical patches installed Visual Studio & SQL Server 2005 Beta
Im trying to use VB.net 2005 to write a sample app to access a DB. Are there any samples for this and any samples of how I go about making the DB in the first place?
Hi, The attached code gives the error "One or more errors occured during processing of command"
What I am trying to do is simply copy a table ("inventry") to a new table name ("bob"). Eventually I want to create a new table based on a filter (as i would using the SELECT INTO command in sql)
I have been running service broker between 3 initaitors and a single target witha forwarder for some time.
Everything works 100%, i use persistent conversation and all queues and transmission_queues are clear. Everything works 100%.
However while running profiler on the forwarder i see the following errors every now and again. Actually every time a message succesfully gets to central i see this error:
On the forwarder: Broker Connection: EventSubClass 4 - Closing :
An error occurred while receiving data: '64(The specified network name is no longer available.)'.
Database ID 1 : master:
ObjectName : tcp:11.45.101.100 - this is the target
i sometimes see the exact same error with a initiator IP.
I am very confused becuase everything is working 100%, queues and transmission queues are all clear.
Hello i constructed the following query in SQL management studio and it runs fine, exactly how i want it to. However when i run it in my code behind i get the error: 'Too many characters in character literal' I desperatly need to use this query exactly how it displays in the mangement tool - why wont it work the same in my code behind? (I am using c# in my code behind and binding the results of the query to a gridview) Regards "SELECT DISTINCT (dbo.AuthorList(publicationID))+ ';' + ISNULL(' Editor: '+Publication.editor, '')+ '' + ISNULL(' "'+Publication.title+'"', '')+ '' + ISNULL(' Book: "'+Publication.booktitle+'"', '')+ '' + ISNULL(' '+Publication.type, '')+ '' + ISNULL(' '+Publication.journal, '')+ '' + ISNULL(' Series: '+Publication.series+'.', '')+ '' + ISNULL(' '+Publication.school, '')+ '' + ISNULL(' '+Publication.institution, '')+ '' + ISNULL(' '+Publication.organisation, '')+ '' + ISNULL(' '+Publication.month, '')+ '' + ISNULL(' ('+convert(nvarchar, Publication.year)+')', '')+ '' + ISNULL(' '+Publication.publisher, '')+ '' + ISNULL(' '+Publication.address+'.', '')+ '' + ISNULL(' '+Publication.howpublished, '')+ '' + ISNULL(' Ed: '+convert(nvarchar, Publication.edition)+'.', '')+ '' + ISNULL(' '+Publication.note, '')+ '' + ISNULL(' Vol:'+Publication.volume+'.', '')+ '' + ISNULL(' No:'+Publication.number+'.', '')+ '' + ISNULL(' Pages:'+Publication.pages+'.', '')+ '' + ISNULL(' Chapter:'+Publication.chapter+'.', '') AS SingleColumn, Publication.publicationID FROM Publication;"