I have a problem with copying data over a db-link. When running the transaction in Query Analyzer it works fine, but when running it via a package, I get the following error-message. Has anyone a solution to this problem ???
Server: Msg 7391, Level 16, State 1, Line 3
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].
Afternoon all,I want my SQL SP to do some validation on a form submit to do the following before committing to the table.If email address (txt.Email.Text) doesn't exist in the table, commit values.if email address (txt.Email.Text) does exist and option (radOptions.SelectedValue) equals 1, print message to say 'you're already subscribed'if email address (txt.Email.Text) does exist and option (radOptions.SelectedValue) equals 0, print message to say 'you're not subscribed'if email address (txt.Email.Text) does exist and option (radOptions.SelectedValue) equals 1 or 0, update row to 0 or 1 (depending on subscribe or unsubscribe - 1 = subscribed, 0 = unsubscribed) The simple SP is currently:ALTER procedure [dbo].[sp_customerSignups]@name varchar(50),@email varchar (50),@subscribed intasBEGININSERT INTO tblCustomerSignups(Name, EmailAddress, Subscribed)VALUES(@name, @email, @subscribed)END Does anyone have the correct syntax for this?Thanks,Brett
I have novice level visual basic knowledge using Visual Studio 2005 and have little knowledge of SQL using SQL express. I am attempting to create a SQL database which initially consists of a single table bound to a Visual Basic form for data entry. So far I have been able to bind a VB form to a SQL database creating a DataSet, DataAdapter, and utilizing the default binding navigator. I also seem to have functioning Stored Procedures.
The VB form is able to add data to the SQL table and I can toggle through the data while the VB app is running but when I terminate the app and load it again all newly added data is not available from the SQL table.
I have seen other strings on this subject and viewed many tutorials but they only bring me as far as I am. None of them address the concept of permanently committing data to SQL from the VB form. FYI€¦data entered manually into the SQL table is stored, just not data from the form.
Hi there, I have decided to move all my transaction handling from asp.net to stored procedures in a SQL Server 2000 database. I know the database is capable of rolling back the transactions just like myTransaction.Rollback() in asp.net. But what about exceptions? In asp.net, I am used to doing the following: <code>Try 'execute commands myTransaction.Commit()Catch ex As Exception Response.Write(ex.Message) myTransaction.Rollback()End Try</code>Will the database inform me of any exceptions (and their messages)? Do I need to put anything explicit in my stored procedure other than rollback transaction? Any help is greatly appreciated
How do you make a live link in SQL 7 to another database? I currently do such things in Access 97 but how do you do it in SQL? I just want to keep a permanent live link to a table in another database.
I am new to SQL Server Development. I will be working on a project which requires a good understanding of SSIS. What are the usual scenarios or tasks I will be given when working on SSIS? Please help!!
Is there a way of searching tables and linking to the relationship used.
I need to find a list of tutors and the session they teach (both available in a session table)
i then need to find the list of members that are enrolled onto each session.
In the session table the relationship allows me to view what members are on each session but i cannot find a code that allows me to see what tutors teach what session and what members attend these lessons.
I spoke to my tutor who did not offer too much help but did say it may be possible to use the "AND" function
Have good grasp of mdb's. Beginner with sqlHave sql db of charity organisations with contact details, all fairlysimple. Have one Field for web addresses entered www.xxxxx.co.uk anotherfor emails entered aaaa@bbbb. Unable to work out how to make these active.Its certainly not like mdb's!Created Page with dropdown list which when clicked gives details ofselected charity. Want the above 2 entries 'live'.Any help from the collective intelligence would be gratefully received.Graham
I downloaded and registered Visual Studio Express Edition. I got this nice email back with links to demos, tutorials, and starter kits. Unfortunately, the links to most of the starter kits are broken. Can I still get these things?
I need some links which guide datetime in sql statement !! Such as : I have a datetime column in my table , I need to calculate the total orders in the today, or yesterday ... Any one know ? Thank you very much .
hi, i have headers at the top of my list and would like for people to click the pubs link and it orders the pubs alphabetically descending and when they click again to ascend also to do this with towns and addresses and postcodes?!
We have a bunch of SQL databases that are used for a similar number of IIS sites (we are talking of close to 500 sites), dealing with a .NET e-learning application
While we manage to create a virtual folder for the e-learning content, we do have one database for each site. So, when it comes to update the whole platform, we are talking about running one script per site, which may take about 5 seconds per user per site. With a total of 300.000 users and sites, it may come to more than 17 days running the update script.
Is there a way similar to that on IIS to create a symbolic link from one table in one database to another table in a diferent database in a diferent or same server?
I have a Summary page on a report and then a detail page. FOr eg on the summary pg, I have a field called 'Name'. eg summary will be on name ie 'A', B, C ETC.. When the user clicks on the summary name ie A, he should be able to directly go to that details for that particular name ie details of 'A'.
How can I achieve this, will be probably thr parameters, but not sure how.
We have replication successfully running but when I tried to set up a new test instance on completely different servers (Server A to Server B, say) the push agent to create the susbcription on Server B complains
'Could not find server 'Server C' in sysservers. Execute sp_addlinkedserver. . . .'
Server C was never configured as a subscriber for the publication in the first place. What's more, Server C is actually a working linked server and definitely is in sysservers for Server A.
I originally tried this on yet another server pair and got a similar message referencing a server name that no longer exists. I stopped messing with that one, figuring it was some historical naming issue I didn't want to mess with. But now I'm stumped and intrigued. Can anyone help?
Is there somewhere that I can change the links that are included in subscription emails? The link that goes out is incorrect because the port number of the server is not included in the link, so I'd like to edit this. Does anyone know where this can be done? Thank you!
I work with a group that develops Access Databases in a LAN environment. We have an issue with others linking into our databases but not letting us know. Does anyone know of a way to determine what other databases have linked into a database to use its data? When we try to modify databases, this becomes an issue since we can not save mods if the file is in use.
I was trying to download SQL Server Management Studio Express from http://msdn.microsoft.com/vstudio/express/sql/download/default.aspx. The links on this page seem to be broken.
I tried to download the Mgmt Studio Express by clicking on a link that points to http://go.microsoft.com/fwlink/?LinkId=65110.
Anyone else facing this issue? Is there another place I can get SQL Server Management Studio Express from?
I have been informed that all my keyword search solutions are susceptible to SQL injection attacks. Does anyone have links discussing basic ' multiple ' keyword search solutions? I would think this is a very common routine (perhaps so much so than only newbies like myself do not know it). I have read the posts about escaping ', doing replace " ' ", " '' ", using parameters and yet every multiple keyword solution I come up with is said to be injection prone. Example: visitor enters: Tom's antiquesinto a TextBox control and the C# code behind securely generates the below call to the database. SELECT L_Name, L_City, L_State, L_Display FROM tblCompanies WHERE L_Kwords LIKE '%' + 'Tom's' + '%' AND L_Kwords LIKE '%' + 'antiques' + '%' AND L_Display = 1 RETURN I understand that concantenting string parts using an array and then passing the sewn together string to a stored procedure exposes it to injection. I hope that my single keyword routine below is secure, if it is not then I am not understanding how parameterized SP are supposed to be constructed to protect against injection.string CompanyName;CompanyName = TextBox1.Text;PROCEDURE CoNameSearch @CompanyName varchar(100)AS SELECT DISTINCT L_Name, L_Phone, L_City, L_State, L_Zip, L_Enabled, L_Display FROM tblLinksWHERE (L_Name LIKE @CompanyName + '%') AND L_Enabled = 1 AND L_Display = 1 ORDER BY L_NameRETURN
I have a table with several columns including 'Path' column where I saved HTML file name and saved all the html pages to root folder of the website. Now I want to make search for text inside the html pages and populate the html page links, so user can click and open the relevant html files.
Can someone give me an idea that how this all process works or refer me to any useful link.
This post is to provide information and Script Library links related to datetime. There are also links to other resources.
List of Subjects Typical Date Query Uses of the DATETIME data type Finding the Start of Time Periods Finding the End of Time Periods Generating Date Tables Getting Time Only from DateTime Finding Age Finding ISO Weeks Converting Year, Month, and Day to DateTime Converting to/from UNIX Time Finding the midpoint between two datetimes Generating Random Datetimes Creating a Formatted Calendar Links to other Date, Time, and Calendar Resources
Typical Date Query How to query a table with a selection on a datetime column, for example, find all items for the date 2006-01-14. This isn’t really a script, but it is one of the most common questions about datetime. Select * from NyTable Where MyDateColumn >= '20060114' and MyDateColumn < '20060115' Notice that you are asking for greater than or equal to the beginning of the date, and less than the following date. You can apply the same general query for any range of days. This is almost always the best way to write a query of this type, because it allows SQL Server to use any index that exists on the datetime column, and it uses less resources than a query that applies a function to the datetime column.
Notice that the query dates are in format YYYYMMDD; you should always use this format for date strings. This is SQL Servers "universal" date format that works the same with all settings of DATEFIRST. Any other format may produce an error if the setting of DATEFIRST is not exactly what you expect.
For datetime strings use universal format YYYYMMDD HH:MM:SS.MIL (20061231 23:59:59.997).
Uses of the DATETIME data type The DATETIME data type can be used to hold four different types of date/time values: 1. Date and time – a date and time together Example: 2006-07-15 12:06:15.333 2. Date – a date only stored as the time at midnight: Example: 2006-07-15 00:00:00.000 3. Time – a time only stored as time on the DATETIME zero date, 1900-01-01. Example: 1900-01-01 12:06:15.333 4. Elapsed time – a difference between two DATETIME values, stored as the time since the DATETIME zero point, 1900-01-01 00:00:00.000. Example: 1900-01-03 14:12:34.443
The actual usage of the value is only defined in the context of the application. There is no way to specify that a DATETIME is to be used for a date and time, date only, time only, or elapsed time. It is possible to insure that a column in a table contains date only or time only by adding a constraint to a column, but is is necessary that the application format the DATETIME value properly.
The following script briefly demonstrates the four different ways to use DATETIME, and several conversions from one type to another: date and time to date only, date and time to time only, date only plus time only to date and time, two date and time values to elapsed time, and elapsed time to individual days, hours, minutes, seconds, and milliseconds.
-- Demo four uses of DATETIME datatype declare @datetime1 datetime declare @datetime2 datetime declare @date_only datetime declare @time_only datetime declare @date_plus_time datetime declare @elapsed_time datetime declare @elapsed_days int declare @elapsed_hours int declare @elapsed_minutes int declare @elapsed_seconds int declare @elapsed_milliseconds int
-- Get date only from datetime using DATEAADD/DATEDIFF functions select @date_only = dateadd(day,datediff(day,0,@datetime1),0)
-- Get time only from datetime by subtracting date only select @time_only = @datetime2-dateadd(day,datediff(day,0,@datetime2),0)
-- Add date only and time only together select @date_plus_time = @date_only+@time_only
-- Get elapsed time as the difference between 2 datetimes select @elapsed_time = @datetime2-@datetime1
-- Get elapsed time parts as time since 1900-01-01 00:00:00.000 select @elapsed_days = datediff(day,0,@elapsed_time) select @elapsed_hours = datepart(hour,@elapsed_time) select @elapsed_minutes = datepart(minute,@elapsed_time) select @elapsed_seconds = datepart(second,@elapsed_time) select @elapsed_milliseconds = datepart(millisecond,@elapsed_time)
Elapsed Time Parts: Days = 2 Hours = 14 Minutess = 12 Secondss = 34 Milliseconds = 443
Finding the Start of Time Periods One of the most common questions is how to remove the time from a datetime so that you end up with just a date. In other words, change 2006/12/13 02:33:48.347 to 2006/12/13 00:00:00.000. The following links have functions that will find the start of Century, Decade, Year, Quarter, Month, Week, Day, Hour, 30 Minutes, 20 Minutes, 15 Minutes, 10 Minutes , 5 Minutes , x number of Minutes ,Minute , or Second. Start of Time Period Functions: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64755 Start of Week Function: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47307 Start of Week Function, Part Deux: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=59927 Convert DateTime to Date using Rounding UDF: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=62354
Finding the End of Time Periods Sometimes there is a need to find the last day of a time period. The following links have functions that will find the last day of Century, Decade, Year, Quarter, Month, or Week. End Date of Time Period Functions: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64759 End of Week Function: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64760
Generating Date Tables It can be very useful to have a table with a list of dates, and various attributes of those dates, especially for complex reporting. The functions on these links can be used to load a date table with many different columns of date attributes. Date Table Function F_TABLE_DATE: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519 Here is another approach that also includes a function for calculating Easter. I haven’t tried it myself. Create Date Table with UK & Easter bank holidays: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49711
Getting Time Only from DateTime By convention, a time only column is stored in SQL Server as an offset from 1900-01-01 00:00:00.000. The function on this link will get the time from a datetime value. Time Only Function: F_TIME_FROM_DATETIME http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=65358
Finding Age Computing the age of someone is more difficult than it might seem when you take into account different month lengths, leap year, and other things. This function returns age in format YYYY MM DD. Age Function F_AGE_YYYY_MM_DD: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=62729 This function returns age in years. Age Function F_AGE_IN_YEARS: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74462 This link is more of a discussion of the problem of calculating age than a script you can use, but it does show the difficulties. I haven’t tried it myself. Calculating age in years: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11578
Finding ISO Weeks The ISO 8601 standard for dates defines a standard way of assigning a unique number to each week starting on Monday. The following functions can be used to return ISO weeks. The date table functions mentioned in the "Generating Date Tables" subject above also have columns for ISO weeks. ISO Year Week Day of Week Function: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60515 ISO Week of Year Function: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60510
Converting Year, Month, and Day to DateTime The functions on this link will take input parameters of Year, Month, and Day and return a datetime. There are several version posted. Make Date function (like in VB): http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=22339
Converting to/from UNIX Time The functions in this script can be used to convert to/from SQL Server date time to UNIX Time. UNIX Time Conversion Functions: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=66858
Finding the midpoint between two datetimes The function in this script finds the midpoint in time between two datetimes. Datetime Range Midpoint Function http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=68806
Generating Random Datetimes The functions on this link can be used to generate random datetimes, random integers, and random samples. Random Integer, Sample, and Datetime Functions http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=69499
Creating a Formatted Calendar There are several methods is this link that will return a result set with a formatted calendar. Calender In Sql Server: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=44865
Links to other Date, Time, and Calendar Resources This post has links to other resources for date and time information, as well as many other commonly asked questions about SQL Server. FAQ - Frequently Given Answers: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210
This blog entry has links to various date time subjects. Fun with Dates (Date Conversion examples): http://weblogs.sqlteam.com/brettk/archive/2005/06/02/5528.aspx
This external link has a lot of information on the SQL Server datetime datatype, writing queries with datetime, and various datetime operations. Demystifying the SQL Server DATETIME Datatype: http://www.sql-server-performance.com/fk_datetime.asp
These external links are a series of articles about working about working with SQL Server Date/Time. Working with SQL Server Date/Time Variables: http://www.databasejournal.com/features/mssql/article.php/10894_2191631_1 Part Two - Displaying Dates and Times in Different Formats: http://www.databasejournal.com/features/mssql/article.php/10894_2197931_1 Part Three - Searching for Particular Date Values and Ranges: http://www.databasejournal.com/features/mssql/article.php/10894_2209321_1 Part Four - Date Math and Universal Time: http://www.databasejournal.com/features/mssql/article.php/10894_2216011_1
This external link explains how the datetime datatypes work in SQL Server, including common pitfalls and general recommendations. Guide to the datetime datatypes: http://www.karaszi.com/SQLServer/info_datetime.asp
These external links discuss the ISO 8601 standards of dates and times. Numeric representation of Dates and Time: http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 A summary of the international standard date and time notation: http://www.cl.cam.ac.uk/~mgk25/iso-time.html
This external link explains how time is calculated on UNIX systems. Unix Time: http://en.wikipedia.org/wiki/Unix_time
These are external links to the U.S. Naval Observatory, an authority in the area of Precise Time. The U.S. Naval Observatory Home: http://www.usno.navy.mil/ The Official Standard of Time for the United States: http://tycho.usno.navy.mil/
This external link has Clock, Calendar, Time Zone, and Holiday information for most of the world: http://www.timeanddate.com/
This external link has a lot of information on the subject of Calendars. Frequently Asked Questions about Calendars: http://www.tondering.dk/claus/calendar.html
If you don't have any idea what all this is about, You may need to Learn SQL: http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp
And finally, the primary Microsoft SQL Server References: SQL Server 2000 Books Online http://msdn2.microsoft.com/en-us/library/aa257103(SQL.80).aspx SQL Server 2005 Books Online http://msdn2.microsoft.com/en-us/library/ms130214.aspx
We have an asp application that runs the reportserver URL for the selected report, passing it through parameters. This opens the report viewer and the report runs.
The problem im having is that one report is not working as expected. When the report is run from report manager, everything works fine. The links do what they're meant to (they link to other reports passing through parameters). When the report is run from our asp application with the report viewer, the links fail.... they dont pass through the correct values or sometimes dont pass through a value at all.
Were the report viewer and report manager applications developed seperately?
In SSRS 2005, is there any way to programatically turn off a Jump To Report link. i.e. set Hyperlink action to none through code. Also is there any way to remove all links upon exporting to excel.
After exporting a RS report to PDF the links(Jump to Report) are removed. Is there anyway to keep the links?
We moved to reporting services about a year ago and have been migrating reportings from our old platform webfocus which when we exported to PDF would retain the links.