[Solved] T-SQL get value from XML

You can do it using XQuery SELECT [TO] = t.XmlColumn.value(‘(ParameterValues/ParameterValue[Name/text() = “TO”]/Value/text())[1]’, ‘varchar(100)’) FROM YourTable t / is a child node navigation. [] is a predicate test on a particular node. So this looks for ParameterValues/ParameterValue which has a Name child with text TO and returns the Value child’s text. Note the use of text() … Read more

[Solved] Writing information from SQL Server to C#

Your query executes an INSERT (IE. Adds data to your table) It doesn’t retrive any record. The INSERT statement in T-SQL could use a SELECT subquery to feed the values that are requested by the columns listed after the INSERT. So your query add a new record every time you run it, but there is … Read more

[Solved] How can I retrieve first second and third word of a String in SQL?

If you don’t want to create a dedicated function, you can use successive CROSS APPLYs: SELECT T.s, FirstSpace.i, SecondSpace.j, ThirdSpace.k, CASE When ThirdSpace.k > 0 THEN LEFT(T.s, Thirdspace.k – 1) ELSE T.S END AS Phrase FROM t CROSS APPLY (SELECT CHARINDEX(‘ ‘, T.s, 1)) AS FirstSpace(i) CROSS APPLY (SELECT CHARINDEX(‘ ‘, T.S, FirstSpace.i + 1)) … Read more

[Solved] Server data accessing from non local network without port forwarding

Yes, it’s possible to access the web server from an external network, depending on your current network configuration. There are two simple solutions I think would suit you. Configure your firewall if needed, enable port forwarding in your router settings to forward port 80 to the internal IP of the machine running your XAMPP-server. If … Read more

[Solved] How to write a pseudo Code [closed]

Pseudo code is just a way to express the intent of the program without being syntactically correct. An example could be: print “What is your name” read input from user print “Hello ” + user input Another example for withdrawing money from an ATM: if the selected account’s balance is greater than the requested amount … Read more

[Solved] SQL query WHERE string LIKE field [closed]

I think the issue is that you have an extra space after the inserted text in the SQL. This means that you are effectively searching for “lblheader.text ” (with a space after it) everytime, which I doubt is what you want. In the SQL statement , change LIKE ‘%”+ lblheader.Text +” %’ “; To LIKE … Read more

[Solved] Select top 1 from each group sql

Maybe this… get the maximum sum for each city and menu item name. Top returns 1 row not one row per group. you need to use the max aggregate to make this work the way you want. you can’t double aggregate max(sum(Quantity)) so you have to either use a sub select, or use a CTE … Read more

[Solved] PHP Insert Table Data Code not Inserting Data into MSSQL Table [closed]

MSSQL doesn’t have a direct md5 function (you can convert it as demonstrated here). You need to use it through PHP like so: $sqla = “INSERT INTO users (username, password) VALUES (‘rob_dewar01’, ‘” . md5(‘KingDozer’) . “‘)”; Also, md5 is not secure. Look into using prepared statements. See the Secure hash and salt for PHP … Read more

[Solved] SQL Select from table where joined values from a second table are a subset of values from a third table

This is a classic Relational Division With Remainder question. You just need to frame it right: You want all Tasks… … whose TaskTags divide the set of all UserTags for a given User There can be a remainder of UserTags but not a remainder of TaskTags so the former is the dividend, the latter is … Read more