SQLXML, Complex Types, And WSDL

Apr 19, 2004

Hello -

I've used SQLXML to generate WSDL from a sample stored procedure that returns customerID and contactName from the 'northwind' database based on a runtime-supplied parameter.

However, the generated WSDL doesn't explicitly name the two columns (customerID and contactName) that the procedure returns. I've tried all of the possible combinations of 'row formatting; and 'output as' when configuring the virtual name. Instead, I get the following:

- <xsd:element name="TestResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RobTestResult" type="sqlresultstream:SqlResultStream" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

To parse the results, I would have to cast the information correctly, which requires some hard-coding. Does anyone have any suggestions on how to force the WSDL file to correctly list out the individual elements in the result set?

Many thanks!

Robert

View 1 Replies


ADVERTISEMENT

Help Passing Complex Variable Types To A Web Service Task

Feb 23, 2007

I need a little help here and appreciate any insight into this issue.

I am building an SSIS package that retrieves data from a database to use in a web service task. So let me give you a little more broad overview of the package so you can understand how this is supposed to roll. A database is queried and those values are dumped into a recordset. A foreach loop uses each row of variables to call the web service and dump the returned values to another database. The first database holds a bunch of fields, but the four fields of interest are: a StartDate (DateTime), a StartFormat (single char), an EndDate (DateTime) and an EndFormat (single char). The output from the query of the first database is the input in the signature of a web service's .Load method. Sounds easy, right? Sure, why not?

Well I dragged the Web Service Task on to the pane and took a look inside. Lo and behold, I can hardcode the variables in for the web service or I can assign the inputs to package variables. How fancy, thanks Microsoft!

But that's where the difficulty begins. The method call for the web service looks like this: service.Load(string, int, GTTimestamp1, GTTimestamp2). The web service is expecting a string, an int, and two objects of the type GTTimestamp, which is a very simple class defined as this:

<System.Xml.Serialization.SoapTypeAttribute("GTTimestamp", "http://util.gtdw.pci.com")> _

Public Class GTTimestamp

Public calendar As Date

Public displayFormat As String

End Class

In the input pane for the Web Service, when I click in the value of the two GTTimestamps like I'm going to hardcode them in, another window pops up saying "Enter the values for complex type -in4" and the pane looks exactly like the previous pane with one very important exception: There is not place to check to assign the value from a package variable!!! Dang you Microsoft!!! I don't really understand why they would leave us out to dry on this... Oh, well, maybe they'll take care of it later...Time to work around it.

SSIS does allow you to create a variable of type System.Object, so after playing with the Web Service for a few minutes and giving up on that, I decided to create a script task that is supposed to create two GTTimestamp objects and assign them to two object variables in the package for passing to the WebService Task. The first challenge was to get the web service to play nice with the script. For those who have never done this, use a command prompt and the wsdl.exe to generate a .vb or .cs file to add to your script file using the right click, add existing item...

Once the file was accessable to my scripts, I created two GTTimestamp objects and assigned them to the Package variables of type System.Object. Running the package, I got this error:

"Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: Type 'ScriptTask_8c868490237b4220b582bdc7c7a3ecae.GTTimestamp' in assembly 'VBAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Not marked as serializable, huh. Okay, so I made the GTTimestamp serializable by adding the <Serializable()> before the class declaration. Then the error changed to:

The error is: Type is not resolved for member 'ScriptTask_8c868490237b4220b582bdc7c7a3ecae.GTTimestamp,VBAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

And here I am, at a loss for what to do from this point. I'm a little lost, so I thought I'd stop and ask for directions. I'm sure I'm not the first to want to use complex variable types.

Only two options at this point. One is to try and store the GTTimestamp in the database and see if SSIS can deal with that. I'm not sure how to store objects in a database or if that is even an option for me, but it came to mind so it made it into this post. The other is to get this to work through the script above that I have run into a wall.

Again, any help is appreciated. Thanks for your time.

View 11 Replies View Related

Sqlxml

Mar 25, 2008

hello all
 
how to store a page(html) in the database.the product description will be very lengthy(above 10000 characters).if stored how to fetch these data and display it?
 
regards
 
Sweety

View 1 Replies View Related

Need Help On SQLXML

Sep 24, 2007

Could someone tell where i can readup on xml in laymans turns so i can get the idea of why we need this. I know it has a lot to do with relational data.

Regards

ROB

View 1 Replies View Related

SQLXML

Jun 8, 2006

Is it possible installation SQLXML 3.0 on Windows 2003 Server???

View 1 Replies View Related

COM ADO And SQLXML V3

Nov 1, 2006

Hi,

I'm in the process of updating an HTA hosted application to SQL Server 2005 Express, using javascript with ADO for database access. I have one function to which I pass an SQLXML query template or updategram for all database queries and updates:

function doSql(sXml) {
var cmd = new ActiveXObject('ADODB.Command');
var conn = new ActiveXObject('ADODB.Connection');
var strmIn = new ActiveXObject('ADODB.Stream');
var strmOut = new ActiveXObject('ADODB.Stream');
var xml = new ActiveXObject(sDOM);
xml.async = false;

try {
conn.Provider = "SQLOLEDB";
conn.Open("Provider=SQLOLEDB.1;Persist Security Info=True;"+
"Initial Catalog=CGIS;Server=(local)\ocean;Integrated Security=SSPI;");
conn.Properties("SQLXML Version") = "SQLXML.3.0";
cmd.ActiveConnection = conn;
cmd.Dialect = "{5d531cb2-e6ed-11d2-b252-00c04f681b71}";
strmIn.Open();
strmIn.WriteText(sXml);
strmIn.Position = 0;
cmd.CommandStream = strmIn;
strmOut.Open();
cmd.Properties("Output Stream").Value = strmOut;
cmd.Properties("Output Encoding").Value = "UTF-16";
var iCount;
cmd.Execute(iCount, null, 0x400);
conn.Close();
xml.load(strmOut);
return xml;
} catch(e) { alert('A database error occured: '+e.description+'Query:'+sXml); }


I understand that SQLServer 2005 has SQLXML built in, which can be accessed using ADO.Net. Can it also be accessed using COM ADO? When I changed the connection string to this:

conn.Open("Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=\.pipeSQLLocalSQLEXPRESS");


I get this error:

'A database error occured:
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].'

Sounds like a connection string error however this was the connection string I pulled out of a .udl file that connected successfully.

Any help/suggestions greatly appreciated!

Andrew

View 1 Replies View Related

Cannot View Wsdl Of Endpoint.

Jun 19, 2007

i created this endpoint in SSMS:






Code Snippet

/****** Object: Endpoint [first_Endpoint] Script Date: 06/19/2007 16:39:22 ******/

CREATE ENDPOINT [first_Endpoint]

AUTHORIZATION [Domainusername]--scrubbed my username out of post!

STATE=STARTED

AS HTTP (PATH=N'/sql',

PORTS = (CLEAR),

AUTHENTICATION = (NTLM, KERBEROS, INTEGRATED),

SITE=N'sitename,

CLEAR_PORT = 80,

COMPRESSION=DISABLED)

FOR SOAP (

WEBMETHOD 'provideInfo'( NAME=N'[adventureworks].[dbo].[uspGetBillOfMaterials]'

, SCHEMA=DEFAULT

, FORMAT=ALL_RESULTS), BATCHES=DISABLED,

SESSIONS=DISABLED, SESSION_TIMEOUT=60,

DATABASE=N'AdventureWorks',

NAMESPACE=N'http://tempuri.org/',

SCHEMA=STANDARD,

CHARACTER_SET=XML)



When i type http://localhost/sql/provideinfo?wsdl into internet explorer, i just get a 404 page cannot be found error.

When i type http://server/sql/provideinfo?wsdl in to the browser i get a Page cannot be displayd error.

I get the same when i type http://myServerName/sql/provideinfo?wsdl

I get the same when i type http://sitename/sql/provideinfo?wsdl



Sql server is running under an account with admin access to the box and sa access to the sql server. what am i doing wrong here that i cannot view my wsdl. oh, the OS is vista.

Could it be a configuration issue that im not seeing?

View 8 Replies View Related

SqlXml - Problem With A Dll

Jun 4, 2007

Hi Group !!
I`m developing a web site with many grids, these grids obtains the data from a SQL Server 2005 DB which data is stored in XML Format... many times when the page load is done, this message appears :
File or assembly name Microsoft.Data.SqlXml, or one of its dependencies, was not found.
But when I access a second time to the same page, the data is displayed normally..Why this could be happening???
Thanks
Diego G. 

View 2 Replies View Related

A Question About Sqlxml

Sep 14, 2006

Who use sqlxml .net?

How can I write code like this:

select count(1) as count from Orders for xml auto

That's error.

 

And what is the correct sqlxml code?

 

Tks.

View 3 Replies View Related

IE Permissions For HTTP Endpoint WSDL

Jan 21, 2008

Hi

I am testing using Web Services from SQL Server 2005 and am having problems with IE Authentication when I try to retreive the WSDL.

The basic scenario is:

I create the Web Service and initially can view the WSDL using Http:ServernamePath?wsdl and also can consume the Web Service in a DotNet app. However after a period of 2 hours or more the the WSDl starts asking for authentication but I cannot determine what authentication or rights are required

In an earlier post http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1175161&SiteID=1 Jimmy Wu mentions
"IE prompted me for my user credentials and after entering the information I was able to retrieve the WSDL doc".

What are the user credentials required and how do you set permissions to avoid these. This forum post is the only place I have seen where any mention is made of some additional credentials being needed.

Regards

nadreck

View 2 Replies View Related

Enpoint Doesn't Display WSDL

Apr 6, 2007

Using SQL2005 Standard on Win2k3 standard ed. Database, SSIS, SSRS and SSNS are installed.



I created an endpoint using the following:



sp_reserve_http_namespace N'http://ServerName:80/Maps'

GO

create endpoint epMaps
state = started
as http
(
path = '/Maps',
authentication = (integrated),
ports = (clear),
site = 'ServerName'
)
for soap
(
webmethod 'GetEnabledMaps'
(Name= 'DBName.dbo.spSelMapPackagesEnabled'),
batches = disabled,
wsdl = default,
database = 'DBName',
namespace = 'http://ServerName/'
)

GO



When I attempt to pull the web service up (http://ServerName/Maps?wsdl 1)I am prompted for my windows credentials and 2) after I put my credentials in a blank page loads.



Anyone have any ideas?

View 5 Replies View Related

Complex DB Search Forms (Store Proc Vs. Complex Where)

Nov 12, 2003

I have web forms with about 10-15 optional search parameters (fields) for a give table. Each item (textbox) in the form is treated as an AND condition.

Right now I build complex WHERE clauses based on wheather data is present in a textbox and AND each one in the clause. Also, if a particular field is "match any word", i get a ANDed set of OR's. As you can imagine, the WHERE clause gets quite large.

I build clauses like this (i.e., 4 fields shown):

SELECT * from tableName WHERE (aaa like '%data') AND (bbb = 'data') AND (ccc like 'data%') AND ( (xxx like '%data') OR (yyy like '%data%') )

My question is, are stored procedures better for building such dynamic SQL clauses? I may have one field or all fifteen. I've written generic code for building the clauses, but I don't know much about stored procedures and am wondering if I'm making this more difficult on myself.

View 7 Replies View Related

SQLXML - Problem With Dlls

Jun 4, 2007

Hi Group !!



I`m developing a web site with many grids, these grids obtains the data from a SQL Server 2005 DB which data is stored in XML Format... many times when the page load is done, this message appears :

File or assembly name Microsoft.Data.SqlXml, or one of its dependencies, was not found.

But when I access a second time to the same page, the data is displayed normally..

Why this could be happening???

Thanks

DiegoG

View 2 Replies View Related

SQLXML Classes Deserializing.... Nothing....

Jul 20, 2005

I am using SQLXML to pass data back and forth, well I am trying to. Itry to follow a tutorial but it didn't work completely. Here is myproblem. After everything executes with NO errors, my class has nodata. Here were my steps.1. In Query Analyzer, I ran my Select statement....Select * From Notifications Where UserID = '4192' and ParentID ISNULL for XML AUTOIt returned...<Notifications ID="1" UserID="4192"CreatedWhen="2004-08-31T00:00:00" ModifiedWhen="2004-08-31T00:00:00"ModifiedBy="1" Class="1" Name="CONSILIUMSOFT" Enabled="1"/>2. I saved the result in Test.xml.3. Ran XSD on it. C:Test>XSD TEST.XMLThis MS utility wrote out the schema file, TEST.XSD4. Ran XSD on it to create the class. C:Test>XSD TEST.XSD /classes/language:csThis MS utility wrote out the CS class file, TEST.cs5. Added the CS file to my project, create a class around it and thecode is below.My problem is that when I put a break point where is says BR (in thecode below), pNotifications has no data in it. All the values areNULL.ANY ideas? I getting desperate....I should mention that I am doingthis in ASP.NET and SQL 2000 sp3Ralph Kraussewww.consiliumsoft.comUse the START button? Then you need CSFastRunII...A new kind of application launcher integrated in the taskbar!ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg************CODE*******************public class CNotifications{SqlXmlCommandobjXMLCommand = newSqlXmlCommand(ConfigurationSettings.AppSettings["XMLConnectionString"]);NotificationspNotifications = new Notifications();public CNotifications(int iID){try{objXMLCommand.RootTag = "Notifications";objXMLCommand.CommandText = @"Select * From Notifications WhereUserID = '" + iID + "' and ParentID IS NULL for XML AUTO";objXMLCommand.CommandType = SqlXmlCommandType.Sql;objXMLCommand.ClientSideXml = true;XmlReader pXMLReader = objXMLCommand.ExecuteXmlReader();XmlSerializer pSerializer = newXmlSerializer(pNotifications.GetType());pNotifications = (Notifications)pSerializer.Deserialize(pXMLReader) ;pXMLReader.Close();}catch (SqlXmlException objEx){objEx.ErrorStream.Position = 0;string strErr = (new StreamReader(objEx.ErrorStream).ReadToEnd());throw new Exception (strErr);}BP}}

View 1 Replies View Related

WebServiceTask Call To ReportingServices Rejects Wsdl

Aug 17, 2006

We're trying to use the WebServiceTask to retrieve a report from the SQL Server Reporting Services (SSRS) web service but getting a "This version of the Web Services Description Language (wsdl) is not supported." error after selecting the Service on the inputs tab. Some additional information...

- I can get other web services to work just fine.

- the SSRS web service works fine as I can download the wsdl in the task window, and we have successfully worked around this issue by creating a proxy class in .NET code and called it through the ScriptTask to get the results we need.

- I'm pretty certain the SSRS server is the 2005 version but can't confirm this.

So the problem seems to be just that SSIS can't read the wsdl created by SSRS.

As said we've worked around the problem successfully but would prefer to use the built in functionality, which should work especially to SSRS. Any help, advice would be greatly appreciated!

View 2 Replies View Related

Why Does The Web Service Task Require A Local WSDL File?

Oct 19, 2007

Have an SSIS package with a Web Service Task, downloaded the WSDL to a local file, all is well until we try to deploy the package to another machine at which point the package expects to find the WSDL in the same place.

Am I not understanding something? Yes I can make it work, BUT:

1. Couldn't the task just get the WSDL from the web service each time, instead of from a static file? Isn't that the idea? Latest and greatest...

2. Having packages dependent on files is extremely inconvenient in a production environment. Security issues abound, things are in different places on different servers. How are folks handling this? The Web Service Task is certainly not the only place in SSIS where a package can be dependent on a file system location.



View 3 Replies View Related

Sql Types - Simple SQL Server Queries/handling Variable Types

May 26, 2005

SQL Server 2000, ASP.Net 1.1

I've been writing this stuff for a while, and can't seem to come to the
conclusion of how I should be retrieving data and assigning this data
to variables.

Since i'm using SQL Server, I'm convinced that I should be using the
datareaders GetSqlDouble (or whatever) function, but this would mean i
need my local variables to be one of the SQL types.  The problem
with that is, that there will have to be lots of conversions done by me
to be able to use a SQL type in my application.

For instance, I have a class where i'm retrieving dates.  In order
to retrieve them correctly (Null values included), I need to retrieve
them with GetSqlDateTime(), then when it comes time to display the date
in a table, i must first check for nulls, then convert to a
string.  This seems to be very cumbersome.  Would I be better
off just using GetDateTime(), and the .ToString method, and ignoring
Sql Types all together?

so, basically, how are you guys using your sql server data?  with
the supplied sql types, and doing all of the post-processing work
manually?  I feel like i'm having trouble conveying my
issue...hopefully someone knows what i mean....i'd just like some
direction to save trouble in the long run, since i feel like there's
got to be a better way...

Confused!

Thanks,
JJ

View 1 Replies View Related

Microsoft SQL Isapi Extension ERROR And SQLXML 3.0

Jan 6, 2007

Hi,
I'm using WinXP SP 2, IIS 5.1, SQL Server 2005 Standard, and Visual Studio 2005 Professional.
 When I create a virtual directory with IIS Virtual Directory Management for SQLXML 3.0, I get a Microsoft SQL isapi extension error when going to the default page.
If I delete the virtual directory, and then add it directly in the IIS snap-in, with executable permissions, all goes well.
My website is from the Wrox book, Beginning ASP.NET 2.0.  An appendix in the book says to add the virtual directory with the SQLXML 3.0 tool, and not to use IIS.  I'm very new to this, so I'm not sure if I'll lose functionality down the road or not, by using IIS.
Has anyone run into this before or have any ideas how to get sqlxml 3.0 virt. dir's to work?

View 1 Replies View Related

SQLXML Bulk Load Of SQL Server Database

May 2, 2007

I need to update a number of sql server tables, the data sources for these coming from a number of stored procedures.  I want a generic way of getting the data and then passing this data to the tables.I am thinking of doing this for each table:Populating a datasetWriting this dataset to XMLUsing  SQLXML Bulk Load to pass this XML to the database to updateI can create the xml data file by:
dataset.WriteXml("C:data.xml")The problem I have is that the example (http://support.microsoft.com/default.aspx/kb/316005/en-us) I looked at relies on the schema being defined:<?xml version="1.0" ?><Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:xml:datatypes" xmlns:sql="urn:schemas-microsoft-com:xml-sql" > <ElementType name="CustomerId" dt:type="int" /> <ElementType name="CompanyName" dt:type="string" /> <ElementType name="City" dt:type="string" /> <ElementType name="ROOT" sql:is-constant="1"> <element type="Customers" /> </ElementType> <ElementType name="Customers" sql:relation="Customer"> <element type="CustomerId" sql:field="CustomerId" /> <element type="CompanyName" sql:field="CompanyName" /> <element type="City" sql:field="City" /> </ElementType></Schema>Is there any way I can create the schema 'on the fly' similar to how I did for the data source file.As I could then pass these files to the database:objBL.Execute ("schema.xml","data.xml"); 

View 1 Replies View Related

Accessing A Report (SSRS 2005) Using PHP And ReportExecution2005.asmx?wsdl

Jan 16, 2008

Hi,

I am using PHP5 and SSRS 2005 to execute a report via ReportExecution2005.asmx?wsdl (using PHP's SOAP functions). I keep getting the error:

"Microsoft.ReportingServices.Diagnostics.Utilities.MissingSessionIdException: The session identifier is missing. A session identifier is required for this operation."

I know what the SessionID after successfully calling the LoadReport method (ExecutionID in the ExecutionHeader) but cannot seem to pass this along to the Render method. Does anyone know how to pass that along?

This is similiar in issue to the post at http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2643092&SiteID=17 but for PHP instead of Java.

Thanks!

View 3 Replies View Related

Microsoft SQLXML Bulkload 4.0 Type Library With SQL Express

Nov 3, 2007

Hello,
I'm trying to follow a sample from microsoft for Using SQLXML Bulk Load in the .NET Environment
In the sample c# console app. it says to select add reference then In the COM tab, select Microsoft SQLXML Bulkload 4.0 Type Library (xblkld4.dll) and click OK.
The problem I have is I cannot find the library or the xblkd4.dll file on my pc.
Does anyone have any suggestions? Any help would be much appreicated.
Thanks
Karl

View 5 Replies View Related

Web Service Task - This Version Of Web Services Description Language (WSDL) Is Not Supported : SOLUTION

Apr 12, 2007

Whilst working with SSRS within SSIS I came accross an issue when trying to create a Web Service Task using the SSRS Web Service. After pointing the task to the WSDL file when I tried to access the Methods of the web service I would get the '....WSDL is not supported.' error. I also noticed that selecting the Download WSDL button would throw up and error as well.



After a bit bit of playing around I found the following solution to the problem.

Make a copy of the ReportingServices.wsdl file and make sure it is not marked as Read-Only.
Point the Web Service Task editor to this new copy of the WSDL file
Set the OverwriteWSDLFile option in the Web Service Task editor to True.

You should then be able to access the details of the WSDL file and the methods of the web service. I am not sure if this issue is by design but hope that this information will help others who came across the same issue?

View 2 Replies View Related

Web Services Task Editor: The Input Web Services Description Language (WSDL) File Is Not Valid

Mar 14, 2006

I am trying to prove I can use SSIS to connect to a web service. The WS I am trying to connect to was developed by a vendor and covered by a NDA, but I was able to reproduce the issue with a public WS.

Here are the steps to reproduce the issue:

In the Web Services Connection Manager, I entered http://office.microsoft.com/Research/Providers/MoneyCentral.asmx?wsdl in the URL window. I am able to successfully "test" the connection
I pasted the above link into IE and saved the resulting XML as a .wsdl file on my local machine. In the Web Services Task Editor, General Tab, I specify the path to the .wsdl file and click on "Download WSDL" button. No Issues
When I click on "Input" and select "MoneyCentralRemote" from the drop-down for Service, I receive an error message saying "This version of the Web Services Description Language (WSDL) is not supported"

So the questions are:

Did I perform the above steps correctly?
What WSDL versions are supported in SSIS?
How can I tell what WSDL version was used to create the .wsdl I am trying to access?
If the WSDL is an unsupported version, is there a work-around to fix the issue?

View 3 Replies View Related

URL Location Of The WSDL File For Web Services File Task

Mar 14, 2007

I am finding that in order to have the Web Services Task work successfully the location of the WSDL file has to be on a local drive that SSIS is executing upon. Is the current intended behavior?

In my SSIS task I use a URL path to store information extracted from the Web Service. The information is stored on a different server than the one that SSIS is running upon. This works properly without error.

I have confirmed that SSIS has appropriate permissions to read/write to that directory on that server. When I attempt to reference the WSDL file (located in the same URL directory that I am saving the information) I get a web services error, 'The Web Services Name is empty, Verify that a valid web service name is available."

When I update the Web Service Task attribute to point to the WSDL file located on a local drive it works correctly. I have confirmed that both WSDL documents are exactly the same.

The behavior seems a little strange...so I must be missing something subtle.

...cordell...

View 2 Replies View Related

One Or More Columns Do Not Have Supported Data Types, Or Their Data Types Do Not Match.

Oct 20, 2007



Hi,

I´m exporting an ms-excel file, then I use a lookup transformation to get a field from a SQL Server 2005 table. The Lookup transformation editor, after selecting the table, shows a warning that says:

at least one mapping between a column from available input columns ans a column from available lookup columns must be defined on the columns page.

So I try to make a relationship in the Lookup transformation editor's column tab where I find the Available input columns and the available lookup columns but I get the following error:

The following columns cannot be mapped:
[Department, DEP_CLEGALCODE]
One or more columns do not have supported data types, or their data types do not match.

The field in SLQ Server is varchar(10) and the input field is a derived column transformation; I have tried different Data Types but I always have the same error.

The DataFlow is: ExcelSource --> Derived Column --> Lookup --> Flat file destination

thanks.

View 6 Replies View Related

Complex SQL (for Me)

Apr 26, 2006

Hello,

Lets look at this table :

CREATE TABLE [dbo].[TableHisto](
[Id] [int] NOT NULL,
[Week] [nvarchar](50) COLLATE French_CI_AS NULL,
[Project] [int] NOT NULL
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Identifiant d''enregistrement' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'TableHisto', @level2type=N'COLUMN', @level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Date de l''enregistrement' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'TableHisto', @level2type=N'COLUMN', @level2name=N'Week'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Projet de référence' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'TableHisto', @level2type=N'COLUMN', @level2name=N'Project'


It is a table where i store projects week reports.

I want to make a request to display a table with project ID in Row, Weeks in columns and either TableHisto.id or Null value in cell.

I use SQL 2005. Thanks for any help

View 9 Replies View Related

Please Help With Complex (for Me) Sql Statement

Sep 3, 2006

I need some help on how to structure a sql statement. I am creating a membership directory and I need the stored procedure to output the Last Name, First Name (and if married) Spouse First Name. Like this Flinstone, Fred & Wilma All members are in one directory linked by two fields. [Family ID] all the family members have the same family id and then there is a Family position id that shows if they are the Husband, Wife or Kids. I have no problem with this part select (LastName + ',' + FirstName) as Name, [Phone 1] as Phone, [Unit Name] as WD, [Street 1] as Street, SUBSTRING(City,1,3) as City, SUBSTRING(Postal,1,5) as Zipfrom Membership Where [HH Order]=1 Order By LastName ASC Could someone help me on how to display the " & Spouse FirstName " as part of the name field only if there is a spouse [HH Order]=2 for the current [Family ID]????

View 6 Replies View Related

Complex Sql Statement

Nov 13, 2006

I need to get multiple values for each row in a database, then do a calculation and insert the calculation and the accountnumber related to the calculation the data, into a different column.  I get an error trying it this way...there is no real identifier, it is jsut something that needs to get done per row...any ideas on how I can accomplish this?
 Declare @NetCommission decimal
Declare @AccountNumber varchar(50)
Set @NetCommission = (select (CommissionRebate * Quantity)
from Account A
Join Trades T on A.AccountNumber = T.AccountNumber)
Set @AccountNumber = (select A.AccountNumber
from cmsAccount A
Join Trades T on A.AccountNumber = T.AccountNumber)
 
Insert into Transaction
(
Payee
,Deposit
,AccountNumber
)
Values
(
'Account Credit'
,@NetCommission
,@AccountNumber
)

View 13 Replies View Related

Complex Use Of Apostrophes

Dec 1, 2006

Hello,
could someone help with this query in a stored proc.?
SET @SQL = 'SET ''' + @avgwgt + ''' = '
'(SELECT AVG(AverageWeight)
FROM CageFishHistory where CageID IN (' + @cagearray + ')
and ItemDate =''' + CONVERT(varchar(23),@startdate) + ''')'
EXEC @SQL
I'm trying to get an average value across  dynamically selected rows. (I'm using a list array to deliver the selection to the stored proc). I need to re-use the average value within the procedure,so it's not enough to output it as a column of the resultset - EG. 'Select AVG(AverageWeight) as AvgWgt' .  If I take out the @avgwgt line it works fine, but otherwise I'm getting this error:
"Incorrect syntax near '(SELECT AVG(AverageWeight)
FROM CageFishHistory where CageID IN ('."
It may be that I can access a column of the resultset in the rest of the procedure, and that would help avoid the use of pesky apostrophes, but I don't know how to do it.

View 3 Replies View Related

I Need Some Help With A Complex Query

Jan 6, 2007

I've written a lot of queries in the past, but I'm having a lot of trouble with this one.

View 4 Replies View Related

Very Complex Query

Mar 19, 2007

I'm sure there is a way of cracking this, but I can't think of a good solution. Right now I am not happy with the solutions I come up with, one of which takes 4 minutes to run on SQL Server
The scenario: User is presented with search page where one or more search terms can be entered/selected. There are no required parameters. It can be any or all of the possibilities presented. Below is a model of the search parameters presented.
The user will either select to show more options under Profile ABC, or go down to Profile STU or Profile XYZ to show more options, or even select all Profiles and then select from Type 1 and either a. or. b. or. c. or ALL of the above.
I cannot predict what a user will make part of the search query so I have to have a stored procedure ready which can handle any or all of the parameters  a user may select.
Am I biting off more than I can chew (it seems so)? Or is there an elegant way of handling the unknown combination of search parameters that a user might throw into my sql query?
I'm running this under ASP 1.0 and SQL Server 2000.
 
[check to show the options below] Profile ABC
[check to shore more options] Type 1




A. Contains fields for entering another data string and selecting from drop-down boxes
B. ditto
C. ditto
D. ditto
[check to show more options] Type 2





A. Contains fields for entering another data string and selecting from drop-down boxes
B. ditto
C. ditto
D. ditto
[check to show more options] Type 3





A. Contains fields for entering another data string and selecting from drop-down boxes




B. ditto
C. ditto
D. ditto
[check to select more options] Type 4





A. Contains fields for entering another data string and selecting from drop-down boxes
B. ditto
C. ditto
D. ditto
[check to show more options] Profile XYZ (as above)
[check to select more options] Profile STU (as above)

View 6 Replies View Related

Need Help With Complex Script

Sep 7, 2007

I'm working on a system that used to load control dynamically into a table structure based on "Row" and "Column" properties in the item object.
The system is now being revamped, and instead of a table structure, it's being loaded into a list, which will be controled by css. The new relevant variables are "Sequence" and "Width."
Since there are already thousands of existing items in the database, I have to write a script that can take a really good guess at legacy items' Row and Col, and input values for Sequence and Width.
 Since all items exist on "tabs," I can query for all items on a given tabID, Ordered By Row, Col -- that will give me a sequence.
Width isn't literal, it has 6 presets: Whole, Half, Third, Quarter, Two Thirds, Three Quarters, represented in the table as 0,1,2,3,4,5 -- for our purposes, I'll assume that all items on a row are equal in width. We can determine width by figuring out the number of items within the same row, so if there is only one in the row, it's a Whole (0), if there are three in the row it'll be a Third (2), etc.
 
I'd like to create a query that gets all items by tab, assigns the appropriate sequence, and figures out how many items are in the row with a given item, to assign the correct width.... but I have no idea how to make t-sql do that. I don't mind multiple queries to get the whole process done, and it doesn't need to be efficient -- this is a one-off script to run to give legacy items values that we can work with.
Where would I start?

View 1 Replies View Related

Complex Query

Oct 30, 2007

HI.
I have 3 tables
1- std with : stdID , programID.
2- Programs with :ProgramID , Cost
3 - Movements with : stdID , balance.
the first table contain the stdID and ProgramID , some times the std hasn't programID that mean he hasn't programID. then we return null.
if the std has programID there is to cases.
the first one he have a movement on his balance then we get the biggest balance for the std.
the second case he hasn't any moventen then we get his balance from Programs  table by the ProgramID .
 
I need sql server function that return table like this
stdID , Balance
 that means every std with his Balance.
Regards.

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved