Viewing 15 posts - 646 through 660 (of 2,007 total)
DECLARE @str1 CHAR(6) = 'Lokesh', @str2 CHAR(5) = 'Gowda';
--View current values
SELECT @str1, @str2;
--Update the variables
SET @str1 = LEFT(@str1,3)+REPLICATE('*',LEN(@str1)-3);
SET @str2 = LEFT(@str2,3)+REPLICATE('*',LEN(@str2)-3);
--View new values
SELECT @str1, @str2;
May 24, 2012 at 5:18 am
lewisdow123 (5/24/2012)
The id is a primary key with automated self incrementing identity, so the next child will always be greater than the previous.
That's not what you said in your original...
May 24, 2012 at 3:07 am
lewisdow123 (5/24/2012)
I'm hoping someone will be kind enough to give me a hand on a little problem I have.
Basically we a relationship table, that uses a parent-child association, this table...
May 24, 2012 at 2:57 am
Jeff Moden (5/23/2012)
Of course, that's also why I generally don't allow XML in any of my databases. 😀
I wish I had the authority to enforce that sort of rule
dwain.c (5/22/2012)
May 23, 2012 at 7:26 am
ColdCoffee (5/22/2012)
using System;using System.Data;
using System.Text;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlInt32 SortDigits(SqlInt32 Number)
{
...
May 23, 2012 at 1:58 am
SQLKnowItAll (5/22/2012)
Cadavre (5/22/2012)
SELECT Num,
((SELECT bits
FROM (SELECT SUBSTRING(CAST(Num AS VARCHAR(19)),n,1),
Num
...
May 22, 2012 at 12:13 pm
SQLKnowItAll (5/22/2012)
Very nice! Now the question plaguing me is... Why on earth would we want to do this?!
The only reason that springs to mind is interview/homework question to see if...
May 22, 2012 at 11:02 am
Bit of a guess: -
SELECT Num,
((SELECT bits
FROM (SELECT SUBSTRING(CAST(Num AS VARCHAR(19)),n,1),
Num
FROM #Number...
May 22, 2012 at 10:52 am
I agree with the previous statements made, you are going to have many difficulties.
However, your current design can be used if it absolutely has to.
SELECT MRN, additional_procedure, additional_procedure_Location,
STUFF((SELECT ','+
...
May 22, 2012 at 8:20 am
Or do it in one go -
DECLARE @sql NVARCHAR(4000);
SELECT @sql =
'exec master.dbo.xp_cmdshell ''rmdir "c:\tempo_SGCTLOCAL\"'', no_output;'+CHAR(13)+CHAR(10)+
'exec master.dbo.xp_cmdshell ''mkdir "c:\tempo_SGCTLOCAL\"'', no_output;'+CHAR(13)+CHAR(10)+
'exec master.dbo.xp_cmdshell ''MOVE '+@caminho+'*.* c:\tempo_SGCTLOCAL'', no_output;'+CHAR(13)+CHAR(10)+
'exec master.dbo.xp_cmdshell ''rd /s/q '+@caminho+''', no_output;'+CHAR(13)+CHAR(10)+
'exec master.dbo.xp_cmdshell...
May 22, 2012 at 6:35 am
dwain.c (5/22/2012)
May 22, 2012 at 5:41 am
dwain.c (5/21/2012)
Create table #basetable(Id int identity, Component varchar(256))
Create table #dailytable(ID Int, FILENAME Char(50), PROCESS...
May 22, 2012 at 5:22 am
Much easier to answer you now.
SELECT '#TmpAct' AS TableName, 'ACCOUNT_ID' AS ColumnName,
COUNT(DISTINCT b.ACCOUNT_ID) AS NumDistinctValues,
MIN(c.ACCOUNT_ID) AS MinValue,
MAX(c.ACCOUNT_ID) AS MaxValue
FROM #TmpAct a
CROSS APPLY (SELECT CAST(a.ACCOUNT_ID AS VARCHAR(MAX))) b(ACCOUNT_ID)
CROSS...
May 21, 2012 at 8:09 am
Welsh Corgi (5/21/2012)
It is close. It returns 9 as the Min value when it should be 8.I'm using a concatenate function in Excel.
Without DDL and sample data that reflects what...
May 21, 2012 at 6:48 am
Total guess having not seen sample data or DDL.
SELECT TableName, ColumnName, COUNT(ColumnName) AS DistinctValues,
MIN(MinValue), MAX(MaxValue)
FROM (SELECT
'ACCOUNT' AS TableName,
...
May 21, 2012 at 6:14 am
Viewing 15 posts - 646 through 660 (of 2,007 total)