Viewing 15 posts - 886 through 900 (of 956 total)
It is really simple to do in Visual Studio, and the steps in 2008 are the same as 2005. When you create the database project, it will ask for...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 13, 2008 at 4:18 pm
The problem is that you have @phone declared as a char(20), which means it is going to have trailing spaces for a phone number. Either explicitly cast/convert it to...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 7, 2008 at 8:01 pm
Hmm, I have to go play with your code now Jeff. I am not surprised that you once again replaced a loop with a Tally/Numbers table. I...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 1, 2008 at 6:18 pm
That is correct, and you can easily modify the code to accept another input and return a scalar value back for a specific part only.
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 1, 2008 at 1:21 pm
You can do this with TSQL very easily with a split function. You can find one on the following link:
http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=StringArrayInput&referringTitle=Home
declare @namestring varchar(1000), @thirdvalue varchar(1000)
set @namestring = 'Smith, John'
SELECT @thirdvalue...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 1, 2008 at 12:38 pm
For this particular question, here is the example code.
DECLARE @InstanceName varchar(100),
@InstanceLocation varchar(100),
@InstancePath varchar(100)
SELECT @InstanceName = convert(varchar, ServerProperty('InstanceName'))
EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE',
@key='Software\Microsoft\Microsoft SQL Server\Instance Names\SQL',
@value_name=@InstanceName,
@value=@InstanceLocation OUTPUT
SELECT...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 1, 2008 at 12:29 pm
You can find the syntax reference here:
http://www.mssqlcity.com/FAQ/Devel/xp_regread.htm
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 1, 2008 at 12:07 pm
Jeff is looking to find out what you are trying to use CLR for. If it is just string splitting, unless you are using extremely long strings, that extend well...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
August 1, 2008 at 6:56 am
While you can do threading in SQLCLR, it is UNSAFE and not recommended. This seems like a job for a SSIS package and a staging table to me. ...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 30, 2008 at 9:09 pm
You need to post the .NET code associated with the Exception for us to assist with this. It sounds like a simple syntax error, but I can't tell without...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 28, 2008 at 6:57 am
Jeff,
Perhaps in my attempt to demonstrate an overly simplistic TSQL Example, I made it far to simple. The OP wants to SELECT a value from any column in a...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 23, 2008 at 11:45 pm
Consider the following example:
CREATE PROCEDURE uspGetObjectIDFromName
(
@ObjectName sysname,
@OutputValue varchar(1000) output
)
AS
DECLARE @sql nvarchar(max)
SET @sql = 'SELECT @Output=convert(varchar(1000), '+@objectname+')
FROM sys.objects
WHERE name = ''sysfiles1'''
DECLARE @Params nvarchar(max)
SET @Params = N'@Output varchar(1000) OUTPUT'
EXEC sp_executesql @sql, @Params,
@Output...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 23, 2008 at 11:14 pm
There are a couple of ways to do this. Just using standard TSQL, you can use XP_REGREAD to read the registry key for the instance root key:
HKLM\Software\Microsoft\Microsoft SQL Server\Instance...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 23, 2008 at 8:27 am
Jeff Moden (7/23/2008)
OK... maybe I'm missing something, but why would you want to do that with a CLR? :blink:
Nope, I am wondering the exact same thing.
It was the...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 23, 2008 at 6:35 am
Muhammad Furqan (7/22/2008)
command.ExecuteScalar().toString()
but i was not handling what to do if "command.ExecuteScalar()" doesnt return...
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
July 22, 2008 at 6:58 am
Viewing 15 posts - 886 through 900 (of 956 total)