I have a SP that works on SQL 2000 but not on 2005
It is just suppose to step through my code and insert values into tables where it finds the "ticked" values
here is apiece of my code. I hope it Helps.
Code Snippet INSERT INTO Members (ClientID, Name, Surname, Email, Username, Password, Active, WlcSent) SELECT ClientID, [Name], Surname, Email, Username, Password, Active, [Welcome Sent] FROM StageMemberUploading WHERE ID = @numValues
SET @CurrentValue = (SELECT SCOPE_IDENTITY()) IF @ClientID IS NOT NULL BEGIN INSERT INTO MemberUsergroup (MemberID, ClientID, UsergroupID) VALUES (@CurrentValue, @ClientID, @UsergroupID) END IF @DateOfBirth IS NOT NULL BEGIN INSERT INTO _MemberProfileCharacterValues (MemberID, OptionID, OptionValue) VALUES (@CurrentValue, 1, @DateOfBirth) END -------------------My Code Stops here ------------------------------ IF @Male = 'x' BEGIN INSERT INTO _MemberProfileLookupValues (MemberID, OptionID, ValueID) VALUES (@CurrentValue, 2, 1) END IF @Female = 'x' BEGIN INSERT INTO _MemberProfileLookupValues (MemberID, OptionID, ValueID) VALUES (@CurrentValue, 2, 3) END
how can I use SQL Svr 2005 Express as database engine in background through VBA code in Excel 2003?
I want to CREATE and DELETE tables and SELECT, INSERT and UPDATE data. Is it possible to use ADO or other database objects to get in contact with SQL Svr 2005 Express?
set @out_dte = '2006-08-03 04:05:12.670' set @FileName = cast(DATEPART(mm,@out_dte) as char(2)) + cast(DATEPART(dd,@out_dte) as char(2)) + cast(DATEPART(HH,@out_dte) as char(2)) + cast(DATEPART(mm,@out_dte) as char(2)) + 'DX.748'
select @FileName
… but then date and time values were left justified spaced filled. Example output: 8 3 4 8 DX.748
I don't just want to get code that works. I want to learn how to write the best possible code.
can any help me why the same exact code works in vb.net but not in C# . case is very simple I have a table called MenuItems which has menu items and a table sizeandprice which has price for each menuitem based on the size. simple case of 1 to many relationship between menuitems table to sizeandprice table. I am trying to display in a gridview control couple of fields from menuitems table and have another template field in which i am display price and size field from the child table which is sizeand price. so basically this is how my code looks like Page in vb works fine <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then Dim ds As SqlDataSource = CType(e.Row.FindControl("SqlDataSource2"), SqlDataSource) ds.SelectParameters("fkMenuItemID").DefaultValue = GridView1.DataKeys(e.Row.RowIndex).Value End If End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PPQ_DataConnectionString1 %>" SelectCommand="SELECT [MenuItemID], [MenuItemType], [ItemName] FROM [MenuItems]"></asp:SqlDataSource> <br /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="MenuItemID" DataSourceID="SqlDataSource1" OnRowDataBound="GridView1_RowDataBound"> <Columns> <asp:BoundField DataField="MenuItemID" HeaderText="MenuItemID" InsertVisible="False" ReadOnly="True" SortExpression="MenuItemID" /> <asp:BoundField DataField="MenuItemType" HeaderText="MenuItemType" SortExpression="MenuItemType" /> <asp:BoundField DataField="ItemName" HeaderText="ItemName" SortExpression="ItemName" /> <asp:TemplateField HeaderText="Size And Price"> <ItemTemplate> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:PPQ_DataConnectionString1 %>" SelectCommand="SELECT [ItemSize], [ItemPrice] FROM [SizeAndPrice] WHERE ([fkMenuItemID] = @fkMenuItemID)"> <SelectParameters> <asp:Parameter Name="fkMenuItemID" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2"> <ItemTemplate> <%#Eval("ItemSize")%>: <%#Eval("ItemPrice", "$ {0:F2}")%><br /> </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
</div> </form> </body> </html>
if you would notice that in order populate my repeater with childrows i need to know the menuitemid from the parent row which i do in rowdatabound event however same code in C# does not render any values for my item price and size defined inside the repeater control. here is how the c# page looks like
The following code does not function if I use SQLOLEDB if I omit the provide and default to ODBC OLE DB it works correctly. I am assume I am coding something wrong for a SQLOLEDB provide. Any help is greatly appricated.
VB Code
Public Function SqlExecuteResult(xSQL As String, sServer As String, sDatabase As String, sUserName As String, sPassword As String, sCaller As String, Optional bLog As Boolean = False) As Object
Dim oDB As Object Dim oRS As Object
Set oDB = CreateObject("adodb.connection") Set oRS = CreateObject("adodb.recordset")
Private Sub Form_Load() Dim rs As Object Set rs = SqlExecuteResult("exec NextEntry 'SentMessages'", "surecomp-bob", "pmsureus33", "sa", "", "") MsgBox rs.fields(0) End Sub
SQL proceedure
CREATE PROCEDURE NextEntry @CounterName Varchar(20) AS
begin declare @counter int select @counter = counter from counters where countername = @counterName select @counter = @counter + 1 update counters set counter = @counter where countername = @countername select counter from counters where countername = @counterName End GO
i had worked on oracle 8i and i am planning to work on sql server 2000,i am requested by a company to help in converting there pl/sql code of oracle 8.0 to something equivalent which works on sql server 7.0 as they want to have similar code on both..i had not worked on sql server 7.0 ,but as pl/sql code works only on oracle stuff..so could kindly anyone guide me in this as to whether there is any product which coverts pl/code (the existing pl/code runs into thousands of line) automatically..i will be very grateful if anyone can enlighten me with such a product(software) or script.. along with its information and site address..any resources and any guidance as to how to go about about this conversion will be very invaluable..hope to hear soon from you guys...early response....will be appreciated..
Can I write a dll(or share the same code) that works on both Mobile device and pc? Since we are using compact edition, we are hoping we can write some common module with the same code that could works on both mobile device and pc platform. I noticed the reference is the same, System.Data.SqlServerCe.dll 3.0.
Another question is, we already have a module for SQLCE2.0, with .net CF1.0. Now, we will start to use compact edition, should we just update on the 1.0 one, or we have to write a different one based on .net CF2.0? Can I use compact edition in CF1.0 dll?
I have a custom code that can gets string from an array:
Public Shared FormatArray() As Object Public Shared Function GetFormat(ByVal _Col As Integer) As String Return FormatArray(_Col) End Function
However if I place the code in a Table details value expression =Code.GetFormat(0), It will give me #ERROR
But if I put in the Table Header row value, then it shows me the String correctly, same for in Footer of the table. Its only within the details rows that is not working
I'm having a strange problem with this but I know (and admit) that the problem is on my PC and nowhere else. My firewall was causing a problem because I was unable to PING the database server, switching this off gets a successful PING immediately. The most useful utility to date is running netstat -an in the command window. This illustrates all the connections that are live and ports that are being listed to. I can establish a connection both by running
TCP 81.105.102.47:1134 217.194.210.169:1433 ESTABLISHED
TCP 81.105.102.47:1135 217.194.210.169:1433 ESTABLISHED
TCP 127.0.0.1:1031 0.0.0.0:0 LISTENING
TCP 127.0.0.1:5354 0.0.0.0:0 LISTENING
TCP 127.0.0.1:51114 0.0.0.0:0 LISTENING
TCP 127.0.0.1:51201 0.0.0.0:0 LISTENING
TCP 127.0.0.1:51202 0.0.0.0:0 LISTENING
TCP 127.0.0.1:51203 0.0.0.0:0 LISTENING
TCP 127.0.0.1:51204 0.0.0.0:0 LISTENING
TCP 127.0.0.1:51206 0.0.0.0:0 LISTENING
UDP 0.0.0.0:445 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:1025 *:*
UDP 0.0.0.0:1030 *:*
UDP 0.0.0.0:3456 *:*
UDP 0.0.0.0:4500 *:*
UDP 81.105.102.47:123 *:*
UDP 81.105.102.47:1900 *:*
UDP 81.105.102.47:5353 *:*
UDP 127.0.0.1:123 *:*
UDP 127.0.0.1:1086 *:*
UDP 127.0.0.1:1900 *:*
Both these utilities show as establishing a connection in netstat so I am able to connect the database server every time, this worked throughout yesterday and has continued this morning.
The problem is when I attempt to use SQL Server Management Studio. When I attempt to connect to tcp:sql5.hostinguk.net, 1433 nothing shows in netstat at all. There is an option to encrypt the connection in the connection properties tab in management studio, when I enable this I do get an entry in netstat -an, see below:
Amost as if it's trying the different ports but you get this time_wait thing. The error message is more meaningful and hopefull because I get:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) (.Net SqlClient Data Provider)
I would expect this as the DNS has not been advised to encrypt the conection.
This is much better than the : Login failed for user 'COX10289'. (.Net SqlClient Data Provider) that I get, irrespective of whether I enter a password or not.
This is on a XP machine trying to connect to the remote webhosting company via the internet.
I can ping the server
I have enabled shared memory and tcp/ip in protocols, named pipes and via are disabled
I do not have any aliases set up
No I do not force encryption
I wonder if you have any further suggestions to this problem?
Can i have a combination of sources some with Unique Identifiers and some without?
I need to know what happens when I have option “Create Code values automatically” selected for the entity and same time pulling Unique Identifier for other sources in same entity stage table.
When we select option “Create Code values automatically” for the entity we creates, then during load from external source to MDM stage we don’t send any values to MDM stage “Code” field and in next step when we execute the stored procedure to load the data from MDM stage to MDM model, it assigns the Code values to each record in MDM stage and MDM model.
I need to know whether after executing the store procedure, will it assign Code values for only NULL records in MDM stage and not give us any error for the records that already have Code values present in MDM stage.
We have a Process Task component setup in a couple SSIS jobs to call a command batch file to support transfering a file via Secure FTP to other servers and the process works fine if we start the SQL Agent job manually, however when the job is started via the scheduler, it fails with an exit code of 4. Even though there is a proxy setup on the agent job, is there a different user account being invoked by the scheduler??? We're on 2005 SP1 Hotfix 1 (2153). Thanks
Some more info...have found that if we leave a login session open on the server (login is the proxy account) the process works. It appears the issue is associated with a need to render/create a command window for the command line/batch process to run in and without an active windows session it fails....would seem to be that a product setup to run on a server in a batch mode would be able to work without this...is this the case? if so, how? Thanks.
I may not be the best forum for this post, however I believe some onecan still help me or direct me somewhere else.I'm finding that win 2003 x64 and SQL 2005 CTP is slower than win 2003and SQL 2000.Machine A: Opteron 2.2 (248) w/ 2 cpus. 8GB memory. SCSI disk array.Windows Enterprise 2003 x64 final release. SQL Server 2005 enterpriseCTP.Machine B: Opeteron 2.2 (248) w/ 2 CPUs. 4GB Memory. IDE Drives.Windows Server 2003 (32bit) and SQL Server 2005 (standard).I'm using Cognos' DecisionStream as the ETL tool (32bit). I have theidentical job on both machines. Machine A is slower to do my nightlybuild (1h 20m) vs. Machine B (50m).I've done no tweaking of the databases. I Used SQL 2005's studio tocopy the database from Machine B to Machine A.The only major difference is the O/S and SQL, the machines are samespeed, however Machine A has twice the memory and faster disk; so Iwould expect it to be faster.Can anyone think of smoking guns I might be missing?TIA
Hello to everyone, I have this problem If I use this code when I try to update a record in my sql database It does not do anything. This is the code. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myconn As New SqlConnection("Data Source=.;Initial Catalog=SistemaIntegral; user id=sa") Dim mycmd As New SqlCommand("presup", myconn) mycmd.CommandType = CommandType.StoredProceduremycmd.parameters.Add(New SqlParameters("@txtClave", SqlDbtype.int,4)).Value=txtClave.textmycmd.parameters.Add(New SqlParameters("@txtForig", SqlDbtype.varchar,50)).Value=txtFOrig.textmycmd.parameters.Add(New SqlParameters("@txtFmod", SqlDbtype.varchar,50)).Value=txtFmod.textmycmd.parameters.Add(New SqlParameters("@txtFeje", SqlDbtype.varchar,50)).Value=txtFeje.textmycmd.parameters.Add(New SqlParameters("@txtPorig", SqlDbtype.varchar,50)).Value=txtPorig.textmycmd.parameters.Add(New SqlParameters("@txPmod", SqlDbtype.varchar,50)).Value=txtPmod.textmycmd.parameters.Add(New SqlParameters("@txtPeje", SqlDbtype.varchar,50)).Value=txtPeje.text mycmd.parameters.Add(New SqlParameters("@txtClave", SqlDbtype.int,4)).Value=txtClave.text myconn.Open() mycmd.ExecuteNonQuery() myconn.Close() mycmd.Dispose() myconn.Dispose() End Sub This is the code for the procedure called "presup" in SQL 2000 Server.CREATE PROCEDURE [presup](@txtClave [int],@txtForig [varchar](50),@txtFmod [varchar](50),@txtFeje [varchar](50),@txtPorig [varchar](50),@txtPmod [varchar](50),@txtPeje [varchar](50),@txtIdPresupuesto [int])as Update [Presupuesto]Set [IdClave]=@txtClave,[orig]=@txtForig,[moda]=@txtFmod,[ejer]=@txtFEje,[origr]=@txtPorig,[modar]=@txtPmod,[ejerr]=@txtPejeWhere ([IdPresupuesto]=@txtIdPresupuesto)GO When I click the Update button of my webform it does not do anything. Please Help me I am new to Visual Studio.Net 2003. (2 weeks ago I started using Visual Studio)
I am receving this error: Failed to open the connection: [Database Vendor Code: 17 ], from .Net 2003/C# to Crystal Report XI with SQL Server 2000 has backend database.
Is there a security permission that has been overlooked?
//Get Table inf from report DB = reportDocument..Database; tables = DB.Tables;
//Looping through all the tables in CR and apply connection info for(int i = 0; i < tables.Count; i++) { table = tables[ i ]; tableLogOnInfo = table.LogOnInfo; tableLogOnInfo.ConnectionInfo = connectionInfo; table.ApplyLogOnInfo(tableLogOnInfo);
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:
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!
I have created a linked server on which following query works fine.
EXECUTE ('SELECT TOP 10 * FROM dummyOBJECTS') AT [REMOTE]
but the same statement executed with openquery
select * from openquery([remote],'select top 10 * from dummyObjects') returns following error.
Msg 7356, Level 16, State 1, Line 1 The OLE DB provider "SQLNCLI" for linked server "remote" supplied inconsistent metadata for a column. The column "dummyObjectID" (compile-time ordinal 1) of object "select top 10 * from dummyobjects" was reported to have a "Incomplete schema-error logic." of 0 at compile time and 0 at run time.
I've got a simple transactional replication set up. I have a separate publisher, distributor, and subscriber with 76 articles (tables only) being pushed from the distributor.
I have this exact setup with the same tables and data working in the SQL 2000 environment. I am testing replication on our SQL 2005 test servers before moving to production, however when the distributor attempts to push out the initial snapshot I keep getting this error.
Error messages:
Incorrect syntax near ')'. (Source: MSSQLServer, Error number: 102) Get help: http://help/102
Incorrect syntax near ')'. (Source: MSSQLServer, Error number: 102) Get help: http://help/102
Incorrect syntax near the keyword 'end'. (Source: MSSQLServer, Error number: 156) Get help: http://help/156
I just installed sql server 2005 and trying to pick it up before I start a new job as a developer using sql server 2005. The problem is that I have three instances installed, the one that works was installed prior to installing sql server 2005 when I installed System Architect a CASE tool which utilizes sql server for its encyclopedias.
My initial installed I used the default settings with the default instance and that does not work. I later ran set up again and installed another instance and that does not work. For some apparent reason the POKIN10SQL instance is over riding everything rendering every other instance non-functional.
When I try to connect to the one of the other instances, the error message is
"An error has occured while establishing a connection to the server. When connection to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL does not allow remote connections. (Provider Network Interface, error: 26 - Error locating Server/Instance Specified) (Microsoft SQL Server)"
I don't think the remote connection is the problem as I went into the properties settings and checked the connection settings and allow remote connections is checked.
In terms of locating the instance, I installed SQL Server as specified in the handbook ... with the default instance and then a named instance.
Something seems to be wrong with the POKIN10SQL instance which was installed with System Architect, I need System Architect so I need a work around rather then an uninstall.
The following query works in SQL Server 2000 but gives follwoing error in SQL Server 2005
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to float.
=======================
SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL AND VWCONTACT.EMAIL LIKE '%@%' AND NOT EXISTS (SELECT VWCONTACT.ID FROM (SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) >= 77002) TMP0 ON VWCONTACT.ID = TMP0.CONTACTID JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) <= 77099) TMP1 ON VWCONTACT.ID = TMP1.CONTACTID WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL ) NESTEDQUERY1 WHERE VWCONTACT.ID = NESTEDQUERY1.ID) AND NOT EXISTS (SELECT VWCONTACT.ID FROM (SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77336) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77338) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77345) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77365) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77396) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77489) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77504) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77598)) ATTR ON ATTR.CONTACTID = VWCONTACT.ID WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL ) NESTEDQUERY1 WHERE VWCONTACT.ID = NESTEDQUERY1.ID) AND NOT EXISTS (SELECT VWCONTACT.ID FROM (SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 23102 AND ATTRIBUTEVALUE = 'Houston') TMP0 ON VWCONTACT.ID = TMP0.CONTACTID JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 22944 AND ATTRIBUTEVALUE = 'TX') TMP1 ON VWCONTACT.ID = TMP1.CONTACTID WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL ) NESTEDQUERY1 WHERE VWCONTACT.ID = NESTEDQUERY1.ID)
when I modify the query like the following in SQL Server 2005 it works. Now the problem is since it is adynamically generated query from our application based on users selection of criteria, it means a lot to us to change the code.
SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL AND VWCONTACT.EMAIL LIKE '%@%'
EXCEPT
((SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) >= 77002) TMP0 ON VWCONTACT.ID = TMP0.CONTACTID JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) <= 77099) TMP1 ON VWCONTACT.ID = TMP1.CONTACTID WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL ) UNION (SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77336) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77338) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77345) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77365) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77396) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77489) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77504) OR (CONTACTATTRIBUTEID = 22943 AND ISNUMERIC(ATTRIBUTEVALUE) = 1 AND CONVERT(float,ATTRIBUTEVALUE) = 77598)) ATTR ON ATTR.CONTACTID = VWCONTACT.ID WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL ) UNION (SELECT DISTINCT VWCONTACT.[ID] ID FROM VWCONTACT JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 23102 AND ATTRIBUTEVALUE = 'Houston') TMP0 ON VWCONTACT.ID = TMP0.CONTACTID JOIN (SELECT CONTACTID FROM VWCONTACTATTRIBUTEVALUE WHERE CONTACTATTRIBUTEID = 22944 AND ATTRIBUTEVALUE = 'TX') TMP1 ON VWCONTACT.ID = TMP1.CONTACTID WHERE VWCONTACT.ACCOUNTID = 2615 AND VWCONTACT.VIRTUALDELETIONDATE IS NULL ))
Most of my packages that I've created in BIDS will NOT run in SQL Server 2005. The simplest one that I have fails during a script task that calls external managed code. I've done all the steps outlined in "Referencing Other Assemblies...", but I'm still getting "Object reference not set to an instance of an object." Here's a sample of a script that's having a problem. The line in green is the one that seems to be cause of the error. This is extremely frustrating. This code will even run from a command line console without error. Why is it so difficult to deploy one of these projects with managed code?
Code Snippet
Public Sub Main() Dim variable1 As String = DirectCast(Dts.Variables("packagevariable1").Value, String) Dim variable2 As String = DirectCast(Dts.Variables("packagevariable2").Value, String) Dim variable3 As Integer = DirectCast(Dts.Variables("packagevariable3").Value, Integer) Dim variable4 As String = DirectCast(Dts.Variables("packagevariable4").Value, String) Dim filePath As String = DirectCast(Dts.Variables("filePath").Value, String) Dim variable5 As String = DirectCast(Dts.Variables("packagevariable5").Value, String) Dim results As Boolean Dim fileGenerator As IProviderInterface Dim intFactory As integrationServiceFactory = New ProviderIntegrationServiceFactory()
Hi! I have installed SQL 2000 and SQL 2005 in my computer.I tried to use some new features like row_number(),try..catch.. but are not working giving syntax error.? So someone told me that i had to check the version and when I cheked I realized I was working with SQL 2000: “Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)? So, how can I change it for working with SQL 2005?. It’s like I’m working with SQL 2005 interface but internally it works as SQL 2000. Can you help me please?
If I run the same FOR XML query in a Development edition enviornment and a Enterprise Edition environment, the results are different. The query is exactly the same.
Here is the query:
DECLARE @MessageBody XML DECLARE @AuditTable SYSNAME DECLARE @SendTrans BIT DECLARE @SendAudit BIT DECLARE @RecordCount INT DECLARE @OperationType CHAR(1)
SET @RecordCount = @@ROWCOUNT SET @OperationType = 'U' SET @SendTrans = 1 SET @SendAudit = 1 SET @AuditTable = 'States'
SELECT @MessageBody = ( SELECT * FROM ( SELECT TOP 10 'INSERTED' AS ActionType, @SendTrans AS SendTrans, @SendAudit AS SendAudit, COLUMNS_UPDATED() AS ColumnsUpdated, GETDATE() AS AuditDate, @AuditTable AS AuditTable, 'test' AS UserName, @RecordCount AS RecordCount, * FROM l_states )AuditRecord FOR XML AUTO, ROOT('AuditTable'), BINARY BASE64)
SELECT @MessageBody
In my DEV env (Developer Edition), this result is produced: <AuditTable> <AuditRecord ActionType="INSERTED" SendTrans="1" SendAudit="1" AuditDate="2007-06-22T15:43:12.497" AuditTable="States" UserName="test" RecordCount="1" StateAbbreviation="AK" State="Alaska" /> <AuditRecord ActionType="INSERTED" SendTrans="1" SendAudit="1" AuditDate="2007-06-22T15:43:12.497" AuditTable="States" UserName="test" RecordCount="1" StateAbbreviation="AL" State="Alabama" /> </AuditTable>
In my Enterprise Edition evn, this is the result: <AuditTable> <AuditRecord ActionType="INSERTED" SendTrans="1" SendAudit="1" AuditDate="2007-06-22T15:44:48.230" AuditTable="States" UserName="test" RecordCount="1"> <l_states StateAbbreviation="AK" State="Alaska" /> <l_states StateAbbreviation="AL" State="Alabama" /> </AuditRecord> </AuditTable>
Does anyone have any idea what might be wrong? Any help is greatly appreciated. Tim
I have SQL 2005 Std Edition, Mixed Security, and remotely connecting by TCP/IP works great.
Named Pipes (and the SQL Native Client) is the only issue.
The problem _appears_ to be that I'm not authenticated under the SQL Machine; however, I'm not attempting to use Windows Authentication, I'm strictly using SQL, so I do not understand why I'm having a problem.
My reasoning for the above conclusion, is that the command "net use \[server_name]ipc$" will allow me to connect to the server, and Named Pipes will begin working. Again, remember that I'm only trying to access named pipes using SQL Authentication.
I've read through everything on the forum and tried everything I could find. Below are the answers from the most common suggestions posted here:
------------------------------------------------------------------------ Version: SQL Server 2005 - 9.00.1399.06 (Intel X86) This is the Default & Only Instance of SQL 2005, named: MSSQLSERVER ------------------------------------------------------------------------
1. The error message with the SQL Native driver (v 9.00.3042): Error 1326, SQL State 08001 [Microsoft][SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [1326]
2. The error messgae with the ODBC SQL driver (v 03.85.1117):
Error 1326, SQL State 01000 [Microsoft][ODBC SQL Server Driver][Named Pipes]Connection Open (Connect())
Connection Failed: SQL Error 17, State 08001 [Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not exist or access denied.
3. Local Connection on Win2003 Server works fine for IP & Named Pipes
4. Remote Connection using SQL Authentication WORKS for IP, does not work for Named Pipes
5. Absolutely *no firewalls* or blocked ports are being used on either machine
6. Configuration Manager & Surface Area Config -- both enabled TCP/IP & Named Pipes Currently listening on ALL IP's. The LOG reports:
Server is listening on [ 'any' <ipv4> 1433]. Server named pipe provider is ready to accept connection on [ \.pipesqlquery ]. Server is listening on [ 127.0.0.1 <ipv4> 1434]. Dedicated admin connection support was established for listening locally on port 1434.
9. Tried both named instance and unnamed instance (although I'm not sure if I'm passing the 'named' instance properly):
Tested: \MYSERVERpipesqlquery Tested: \MYSERVERpipeMSSQL$MSSQLSERVERsqlquery (although the named instance doesn't work on the server either)
10.I've setup an alias for the named pipe connection. This was based on a suggestion posted here, but didn't work.
11.I've removed the shared-memory protocol, on another suggestion here, but no luck.
12.If I execute "net use \[server_name]ipc$" it asks for credentials and if I enter the server credentials I have no problem with executing that command. In other words the logged-on user is not an authenticated member of the server; however, I'm not attempting to use windows authentication, I'm using SQL Authentication.
I've created an SSRS report in Visual Studio 2005 which runs fine in the preview. I have a list of server names which when clicked on expands to a list of databases on the chosen server. When I click on a database it then queries a table of information and displays information on that database. The query is something like:
SELECT * FROM MyDB.dbo.DB_info WHERE ServerName = @ServerName and DBname = @DBname
This works fine in preview mode. When I run it in SQL Management Studio via the Custom Reports menu it only works when the chosen server is the one that contains MyDB. I've run a trace and can see the query being issued when I use preview mode. However, when I run it from SSMS I don't see any query being issued to the database. This seems strange as it does return data in the instance described above and if I put MyDB into single-user mode it then complains that it can't access it so it is obviously trying to communicate with the database but not showing up on the trace. I've selected all events and only put a filter on the database name.
Seeing as all of the information is in the same table it seems odd that they query only works when the server name is the one where the database is held and that the query is not shown up in a trace. I'm running the report under the same credentials too.
I'm completely baffled by this so I'd be very grateful if someone could explain what might be happening here.
I have installed SQL 2000 and SQL 2005 in my computer. But none of 2005 feature is working. So someone told me that i had to check the version and when I cheked I realized I was working with SQL 2000: Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)?
So, how can I change it for working with SQL 2005?. Its like Im working with SQL 2005 interface but internally it works as SQL 2000. Can you help me please?
Hi all,I'm having a big problem here. I can't seem to connect to a database of MSSQL Server 2005... Here is what I've did:1. Under the Server Explorer>Data Connections. Right click and choose "Add Connection..."2. Data Source was "Microsoft SQL Server Database File". Click OK.3. I browse to the database in the MSSQL.2/MSSQL/Data folder.4. Click on the "Advanced" button, and change the default DataSource from .SQLEXPRESS to .MSSQLSERVER. Click OK5. Received this error:An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default setting SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) Only .SQEXPRESS that I was able to connect to... i've tried the solution from Microsoft, opened SQL Server 2005 Surface Area Configuration and enabled "Local and remote connections", checked the option "Using both TCP/IP and named pipes" but it didn't help. This is frustrating because I can't get the Membership provider, login to work on my host. Please help. Thank you very much,Kenny.
Hello. I'm having troubles with a query that (should) return all therecords between two dates. The date field is a datetime type. The db isSQL Server 2000. When I try thisSELECT RESERVES.RES_ID, PAYMENTS_RECEIVED.PYR_ID,PAYMENTS_RECEIVED.PYR_VALUE, PAYMENTS_RECEIVED.PYR_DATE,CUSTOMERS.CUS_NAMEFROM RESERVES LEFT OUTER JOINPAYMENTS_RECEIVED ON RESERVES.RES_ID =PAYMENTS_RECEIVED.RES_ID LEFT OUTER JOINCUSTOMERS ON RESERVES.CUS_ID = CUSTOMERS.CUS_IDWHERE (PAYMENTS_RECEIVED.PYR_DATE >= '2006-03-20 00:00:00') AND(PAYMENTS_RECEIVED.PYR_DATE < '2006-03-27 00:00:00')on a "query builder" in visual studio, I get the results that I want.But when I use exactly the same query on an asp 3 vbscript script, Iget no results (an empty selection).I've done everything imaginable. I wrote the date as iso, ansi, britishformat using convert(,103) (that's how users will enter the dates),i've used cast('20060327' as datetime), etc. But I can't still get itto work. Other querys from the asp pages work ok. Any ideas?thanks a lot in advance
SQL 2005 SP2 install succeeds but in SQL Maintenance Studio the instance is still 9.0.1399. Also when I interogate using TSQL it is reported as 9.0.1399
Here's the log (I did try it a couple of times)
Time: 01/25/2008 13:25:05.338 KB Number: KB921896 Machine: ------------- (I took this out) OS Version: Microsoft Windows Server 2003 family, Standard Edition Service Pack 2 (Build 3790) Package Language: 1033 (ENU) Package Platform: x86 Package SP Level: 2 Package Version: 3042 Command-line parameters specified: Cluster Installation: No ********************************************************************************** Prerequisites Check & Status SQLSupport: Passed ********************************************************************************** Products Detected Language Level Patch Level Platform Edition Setup Support Files ENU 9.2.3042 x86 Reporting Services (MSSQLSERVER) ENU SP2 9.00.3042.00 x86 STANDARD SQL Server Native Client ENU 9.00.3042.00 x86 Client Components ENU SP2 9.2.3042 x86 STANDARD MSXML 6.0 Parser ENU 6.10.1200.0 x86 SQLXML4 ENU 9.00.3042.00 x86 Backward Compatibility ENU 8.05.2004 x86 Microsoft SQL Server VSS Writer ENU 9.00.3042.00 x86 ********************************************************************************** Products Disqualified & Reason Product Reason ********************************************************************************** Processes Locking Files Process Name Feature Type User Name PID ********************************************************************************** Product Installation Status Product : Setup Support Files Product Version (Previous): 3042 Product Version (Final) : 3042 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRedist9_Hotfix_KB921896_SqlSupport.msi.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : Reporting Services (MSSQLSERVER) Product Version (Previous): 3042 Product Version (Final) : 3042 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRS9_Hotfix_KB921896_sqlrun_rs.msp.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : SQL Server Native Client Product Version (Previous): 3042 Product Version (Final) : 3042 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRedist9_Hotfix_KB921896_sqlncli.msi.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : Client Components Product Version (Previous): 3042 Product Version (Final) : 3042 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixSQLTools9_Hotfix_KB921896_sqlrun_tools.msp.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : MSXML 6.0 Parser Product Version (Previous): 1200 Product Version (Final) : 6.10.1129.0 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRedist9_Hotfix_KB921896_msxml6.msi.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : SQLXML4 Product Version (Previous): 3042 Product Version (Final) : 3042 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRedist9_Hotfix_KB921896_sqlxml4.msi.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : Backward Compatibility Product Version (Previous): 2004 Product Version (Final) : 2004 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRedist9_Hotfix_KB921896_SQLServer2005_BC.msi.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- Product : Microsoft SQL Server VSS Writer Product Version (Previous): 3042 Product Version (Final) : 3042 Status : Success Log File : C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixRedist9_Hotfix_KB921896_SqlWriter.msi.log Error Number : 0 Error Description : ---------------------------------------------------------------------------------- ********************************************************************************** Summary Success Exit Code Returned: 0