|
If there is no relationship between the tables then that would not be possible unless you create one or you are getting only 1 record from each table, then you could use a cross join
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The only relationship is the master order table, but it can be different in 3 scenarios
I'll check out the cross join.
Last night I just used one of the master tables, and wrote 2 functions.
|
|
|
|
|
If each of the three resultsets contains exact the same columns, then you can use the UNION keyword.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If there's exactly one matching record to each other and they're in the same order you could use the ROWID to join them / to update the tables without ID with the ID from CUSTOMER_CARDDATA.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Can we install any version of sql server on Windows 8.1?
|
|
|
|
|
Probably not "any", but any recent Express version should do.
Full specs here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to use SQL Server in Windows 8, Windows 8.1, Windows Server 2012, and Windows Server 2012 R2[^]:
- SQL 2005: Not supported.
- SQL 2008: Needs at least SP3.
- SQL 2008 R2:
- Needs at least SP2 on Windows 8.1 / Server 2012 R2;
- Needs at least SP1 on Windows 8 / Server 2012;
- SQL 2012:
- Needs at least SP1 on Windows 8.1 / Server 2012 R2;
- No SP required for Windows 8 / Server 2012;
- SQL 2014: No SP required.;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We have a software that provide data from automobile (like parts of various vehicle). For now we release / provide DVDs at a regular interval of time to our users so that they can remain updated with required data.
Now we are planning to provide data update via internet i.e. client's DB can be updated based on some information available on internet. This will help us to get rid of releasing monthly DVDs.
Any idea on the process? Please help.
|
|
|
|
|
This is simply a method of delivery, all you need to do is get your user to download the DVD content and initiate the local update. So get your app to check a URL for an update available flag and prompt the user to download and then install using your current method.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You will get better ideas if you reply through the forum! There are others who will be able to help better than I.
Kukreja Sonu wrote: Thanks Holmes. As of now we write all the changed data into an XML file at server and upload the same to a centralized location. Then client downloads the xml and executes queries one by one accordingly to update target DB.
But this is a long process:
1. Populating DB at server with change only data
2. Initiate process to prepare XML based on above data.
3. Client downloads the XML and update target DB.
This takes around 3-4 days for single run. So, we want to have some other process if possible to minimize the time
The more I think about this the nastier it gets, are you up to changing the way you identify your change sets or do you have to stick with the current design/structure?
First I would look into change the format from xml to something less verbose. XML is fine for communication as a transport medium it sucks. We use CSV.
It sounds like each client has a different requirement!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
SELECT
Label
, (SELECT BFirstName, BLastName FROM CARDINFOPERM WHERE CardID = 1121) AS BAttention
, BCity
FROM CardInfoPerm
WHERE CardID = 1121
|
|
|
|
|
Perhaps
(SELECT CONCAT(BFirstName, ' ', BLastName) FROM CARDINFOPERM WHERE CardID = 1121) AS BAttention
This works, not sure if it's safe
(SELECT CONCAT(BFirstName, ' ', BLastName)) AS BAttention
modified 2-Jun-15 16:21pm.
|
|
|
|
|
Since it's the same table you can just write it like this:
SELECT
Label
, CONCAT(BFirstName, ' ', BLastName) AS BAttention
, BCity
FROM CardInfoPerm
WHERE CardID = 1121
jkirkerx wrote: not sure if it's safe If you're thinking about null-values:
Quote: Null values are implicitly converted to an empty string. If all the arguments are null, an empty string of type varchar(1) is returned. (From https://msdn.microsoft.com/en-us/library/hh231515.aspx[^])
So you might want to surround the CONCAT(..) with a TRIM(..).
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Cool
Thanks for the quick help Sascha!
|
|
|
|
|
You're welcome!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I know I should use a stored procedure to do this but ths is not possible. In the code below return values from the "select" statements are being assigned to code variable values being concatenated with the actual Select statement. I am not talking about the code in the Where clause but the code in the "Select" portion. See the string as below:
query.Append(" SELECT e581_key, 'e581', 'rnlt', rnlt, '" + _rnlt + "' , 'SaveEditRNLT', '" + _logUserName + "', getdate() ");
query.Append(" FROM e581 "); <pre>
The select statement is then assigned to the DbCommand.CommandText of the command.ExecuteNonQuery.
How do I move the actual code variables being concatenated to some type of command parameter?
modified 2-Jun-15 15:29pm.
|
|
|
|
|
You need to pass the variables as parameters, in exactly the same way as you would for the WHERE clause:
using (var command = new SqlCommand("", connection))
{
var query = new StringBuilder();
...
query.Append(" SELECT e581_key, 'e581', 'rnlt', rnlt, @rnlt, 'SaveEditRNLT', @logUserName, getdate() ");
query.Append(" FROM e581 ");
command.Parameters.AddWithValue("@rnlt", _rnlt);
command.Parameters.AddWithValue("@logUserName", _logUserName);
...
command.CommandText = query.ToString();
...
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I don't understand what you mean. for instance take the code below:
query.Append("SELECT e581_key, 'e581', 'pickup_date', pickup_date , '" + _dateMaterialRequired + "' , 'SaveEditPickup', '" + _logUserName + "', getdate() ");
<pre>
Now _dateMaterialRequired and _timeMaterialRequired are variables, properties, that belong to the to the class that called the hard coded SQL statement. When the SQL is called how are the select statement return values assigned to the variables, properties, that are in the calling code?
|
|
|
|
|
What?
The code you've shown passes the value of the variables from C# to SQL - using string concatenation, so it's vulnerable to SQL Injection. Those values are returned as part of the result-set of the query.
Nothing in the code you've shown will update the value of the C# variables.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In the select statement I did not include the "Where" clause by mistake. But these values are being filled in by the Where clause. Sorry.
|
|
|
|
|
No, that still doesn't make any sense.
holdorf wrote: how are the select statement return values assigned to the variables, properties, that are in the calling code?
holdorf wrote: But these values are being filled in by the Where clause.
Executing a SQL query will never automatically update the value of a C# variable.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I guess I am not making myself clear. This is working SQL code that update the C# variables from the query after it is called. What my job is to remove all of the SQL inject errors that exist from this working code.
|
|
|
|
|
No, what you have posted is working-but-vulnerable code which executes a query that includes the values of some C# variables in the results.
At no point does the code you've posted update the value of any C# variables.
Either you've forgotten to post that part of the code, or the code isn't doing what you think it's doing.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I had a datbase with MDF file size 7GB but LDF file size is now 202GB. its big issue with my server. whats the best solution?
i tried to shrink but nothing happend. i took backup of logs but issue is still persist.
|
|
|
|
|
What the recovery mode of your DB?
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|