Showing posts with label examples. Show all posts
Showing posts with label examples. Show all posts

Sunday, March 11, 2012

Complicated Inserts

Hello everyone, im looking for some advice or maybe examples.

How is the best method of checking a table for a specific IP address located as an element value of a xml data type.

For example

xmlNode = Table in use

myXmlData = Document being stored as XML datatype

I would like to first check the table of existing XML entrys for an ip address that is within the current xmldata in the reader.

If the ip address in the reader matches any of the ones in the database it will update that row.

If the ip address can not be found in any existing row, a new row is created and myXmlData is stored.

At the moment data is stored regardless of existing entrys.

myQuery = "INSERT INTO T4(xmlNode) VALUES(@.myXMLData)"

If only things were simple eh !

INSERT INTO T4(xmlNode) VALUES(@.myXMLData) WHERE xmlNode.Childvalue = (?)

I know the above is totally wrong and syntaticlly rubbish but its along that idea.

Excause my SQL ignorance but im a bit of a newbie.

Examples are few to none, and few do not do anything like what i need.
Is it even possible ?

Regards

Russ

Since you want the logic "insert if the IP does not exist", your statement will go as follows:

IF EXISTS (SELECT * FROM T4 WHERE xmlNode.exist ('//ip[. = sql:variable(@.searchIPValue)]') = 1)
UPDATE T4 SET xmlNode = @.myXmlData
WHERE xmlNode.exist ('//ip[. = sql:variable(@.searchIPValue)]') = 1
ELSE
INSERT INTO T4 (xmlNode) VALUES (@.myXmlData)

Note that table name = T4 and XML column name = xmlNode (unlike what you have mentioned above).

Since the lookup on IP seems to be common in your workload and only a single IP occurs in each XML instance, you may want to promote it into a column to simplify the statment above. See the MSDN whitepaper for http://msdn.microsoft.com/xml/default.aspx?pull=/library/en-us/dnsql90/html/sql25xmlbp.asp for more information

Sunday, February 19, 2012

Compiled Code as a data source

Does anyone have any examples of a c# program and that returns a record set
from sql server that could be compiled and referenced as a data source in an
RDL file? If so I would sure like an example of the C# and the RDL file that
references it. Thanks.no.. but MS Access can do this for sure
On Apr 19, 7:10 am, Greg Larsen <gregalar...@.removeit.msn.com> wrote:
> Does anyone have any examples of a c# program and that returns a record set
> from sql server that could be compiled and referenced as a data source in an
> RDL file? If so I would sure like an example of the C# and the RDL file that
> references it. Thanks.|||Instead use web services using c# to directly access the datasource and
reports itself. A good sample is given in the BOL.
Amarnath
"Greg Larsen" wrote:
> Does anyone have any examples of a c# program and that returns a record set
> from sql server that could be compiled and referenced as a data source in an
> RDL file? If so I would sure like an example of the C# and the RDL file that
> references it. Thanks.|||yeah.. or you could write your own compiler and install linux
I mean wtf
fuck web services
fuck C#
can I put a form in a BI project and loop through all of the reports
in my PROJECT?
until I can do this; SSRS can fuck themselves
On Apr 19, 11:28 pm, Amarnath <Amarn...@.discussions.microsoft.com>
wrote:
> Instead use web services using c# to directly access the datasource and
> reports itself. A good sample is given in the BOL.
> Amarnath
> "Greg Larsen" wrote:
> > Does anyone have any examples of a c# program and that returns a record set
> > from sql server that could be compiled and referenced as a data source in an
> > RDL file? If so I would sure like an example of the C# and the RDL file that
> > references it. Thanks.

Tuesday, February 14, 2012

Compatibility Mode 70 databases in SP2

Hi
I would not say that this would be deemed a major issue as it is simple to
write your own maintenance procedures, and there are examples if you search
the web.
It is also recommended that compatibility mode is mainly designed as a
transient part of an upgrade and should not normally be something to be
relied upon long term, unless there is no way you can upgrade change the
database. If the latter is the case then your buisiness may be at risk if you
are relying on such software.
John
"Axel Bender" wrote:

> Hi,
> Does anybody know if the creation of maintenance plans for Compatibility
> Mode 70 databases will be possible with SQL Server 2005 SP2?
> According to what I've heard so far, there is no chance to do that in
> SP0/1 installations of SQL Server 2005 (CM 70 databases won't show up in
> the wizard). I consider this a severe shortcoming in the product, which
> should be tackled by MS.
> Any opinions/workarounds?
>
Hi Axel
I suggest that you ship some standard jobs and procedures that will do this
for them and avoid the maintenance plans.
I don't really have any idea how widespread this issue is how much it would
actually take to implement this additional feature, but I can only assume
that it is not as big an issue as you think or MS is not aware of the
magnitude. If you wish to formally request a response and make them aware of
this issue I would raise a support call.
John
"Axel Bender" wrote:

> Thanks for the answer, John.
> Although I generally agree with you in saying that a compatibility mode
> should not be used on a long-term basis, I have to make some additional
> points on that topic:
> a) We have deployed a lot of CM 70 databases; changing the compatibility
> mode for them would not break our application, but it would give the
> users very slow response times in parts of the app (this is due to the
> change MS made to the query optimizer when it comes to selecting
> indexes). We know we have to make changes to the app, but frankly, we
> simply cannot afford the time for this now.
> b) Most of our customers are not able to write maintenance procedures
> (nor are all of our supporters).
> c) There is no common scheme that our users follow when it comes to
> backing up and checking their databases.
> d) S2k5 supports maintenance plans for CM 80 databases, why not for CM
> 70 ones?
> I think, that supporting CM 70 databases would not be a big deal for MS;
> for us it would be.
> Kind regards,
> Axel
>