Wednesday, March 20, 2013

[SQL Server] Unable to find Server name on my local machine.

[SQL Server] Unable to find Server name on my local machine.


Unable to find Server name on my local machine.

Posted: 19 Mar 2013 10:39 PM PDT

Hi,I have installed SQL Server 2005 backward compatibility installed on my local machine. I am seeing it in the program & features section as installed. The version is 8.05.1054. It does not showup under all programs and i am unable to find server name on my system. I have admin rights to my system and still when i try to access the server name as localhost it says i need atleast read rights.Could some one help me.Regards,Renato.

Possible to use this in an 'SP_ExecuteSQL'?

Posted: 20 Mar 2013 12:44 AM PDT

Hi Guys, I'm looking to use an SP_ExecuteSQL that would allow me to retrieve the following, and add some additional spice to the query when needed. Doing it this way allows for me to add complexities to it in the future. I have about 9 parameters in my query, but only list one since all the rest will follow suit.I'm looking to use a comma delimited string that allows me to select multiple variables in a parameter. However, I'm not sure how to add this into my query below:declare @system_status varchar(30)select @system_status = '12'declare @sql nvarchar(4000) select @sql = 'SELECT [system_status] FROM VW_Document_Main where 1=1 'if @System_Status = '-1' Begin select @sql = @sql + 'and system_status <> 20' End else if @system_status is not null and @system_status not in ('-1','0') Begin select @sql = @sql + 'and ','+REPLACE(@system_Status,'','')+',' LIKE '%,'+system_Status+',%''I run into several issues: Firstly, the addition to the @sql must be in a string concatenation or else it won't recognize the column name "system_Status" however, when it is in the string, I seem to be having issues with the commas. When I run the query without the @SQL variable it works fine:declare @system_status varchar(30)select @system_status = '9,20'SELECT [system_status] FROM VW_Document_Main WHERE 1=1AND ','+REPLACE(@system_Status,'','')+',' LIKE '%,'+system_Status+',%'I'm sure it just has something to do with some misplace commas, or bad script. Any guesses as to how to attack?

how to insert datetime column into table

Posted: 20 Mar 2013 01:00 AM PDT

All,I'm having strange issue trying to do the following which I thought was just going to be straight forwardselect top 5 machine.name, machine.model, machine.scantime 'INSERT INTO [SMS_000].[dbo].[BMCMachines] ([ComputerName],[MachineModel],[stime]) VALUES (' + '''' + machine.name + ''',' + '''' + machine.model + ''',' + convert(datetime,machine.scantime,112) + ''')' from machine when I run the query comes back with following errorMsg 241, Level 16, State 1, Line 1Conversion failed when converting date and/or time from character string.I can confirm that machine.scantime is "DateTime" column.

powershell and ssis

Posted: 19 Mar 2013 09:40 PM PDT

hi all, im trying to build a data collection of various sql servers. currently i do most of the data gathering just running a dmv query in ssis and loading the data into my collection db.Id like to be able to use powershell to run some queries and add that data to the collection db as well. but struggling at the moment.. I can get powershell to run in ssis (made a simple create folder script and ran it in ssis) but i cant work out how to gather data with posh then push it out to a db.. thanks for any help

No comments:

Post a Comment

Search This Blog