Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

If you are using Google-Collections/Guava you could do the following:

***InputStream stream = ...
String content = CharStreams.toString(new InputStreamReader(stream, Charsets.UTF_8));
Closeables.closeQuietly(stream);***
Note that the second parameter (i.e. Charsets.UTF_8) for the InputStreamReader isn't necessary, but it is generally a good idea to specify the encoding if you know it (which you should!)
3 years ago
Easiest Solution:
CREATE TABLE #temp (...);
***
INSERT INTO #temp
EXEC [sproc];
***
If you don't know the schema then you can do the following. Please note that there are severe security risks in this method.
***
SELECT *
INTO #temp
FROM OPENROWSET('SQLNCLI',
'Server=localhost;Trusted_Connection=yes;',
'EXEC [db].[schema].[sproc]')
***
3 years ago
A standard SQL approach would be
***
UPDATE ud
SET assid = (SELECT assid FROM sale s WHERE ud.id=s.id)
On SQL Server you can use a join
****
****
UPDATE ud
SET assid = s.assid
FROM ud u
JOIN sale s ON u.id=s.id
***
3 years ago
While other suggestions here seem valid, there is one other good reason. With plain String you have much higher chances of accidentally printing the password to logs, monitors or some other insecure place. char[] is less vulnerable.

Consider this:
***
public static void main(String[] args) {
Object pw = "Password";
System.out.println("String: " + pw);

pw = "Password".toCharArray();
System.out.println("Array: " + pw);
}
***
Prints:
***
String: Password
Array: [C@5829428e
***
3 years ago