Generating SQL SP checksum [closed] - sql

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
does anyone know of a way to generate some kind of checksum for each Stored Procedure on a server, in order to be able to compare them to other SP's on different servers?
Regards,
Jeroen

You could;
SELECT
ROUTINE_NAME,
HASHBYTES('SHA1', ROUTINE_DEFINITION)
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = 'PROCEDURE'
AND OBJECTPROPERTY(OBJECT_ID(ROUTINE_NAME), 'IsMSShipped') = 0

Related

Is there a way to remove specific characters from SQL Server Column [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a database table that contains a column for pricing.
Its very old, so it was written before i understood datatypes. so we are using varchar for a money value.
Ive noticed some columns have $ in them, so what I'm wondering is... is there a way with SQL Server to perform an update of the table and remove any instances of non numeric characters or at the very least remove the $ from the string in the columns in one go ?
I hope this is possible.
Update tbl
SET price = replace(price, '$', '')
Here is the replace definition

Access 2010 SQL Update Query [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I need to update every row in one table, with the help with two subqueries...
UPDATE MyTable
SET MyTable.ColumnToUpdate =
((SELECT 10000 / DCount("ID","MyTable")) * DCount("ID","MyTable","ID<="& MyTable.ID))
But this doesn't work, access complanis about an error in the first subquery...
How can i do this?
Thanks
You don't need the SELECT statement in the first piece. Try this:
UPDATE MyTable
SET MyTable.ColumnToUpdate =
((10000 / DCount("ID","MyTable")) * DCount("ID","MyTable","ID<="& MyTable.ID))

SQL Server queries with datetime [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have old program with access database. I want rewrite it to MS ACCESS. In queries u have text value mm/yyyy in query how to convert it to datetime from string?
DECLARE #a nvarchar(100)
SET #a = '12052013'
SELECT CONVERT(DATETIME,LEFT(#a,2) + '/' +
SUBSTRING(#a,3,2) + '/' + RIGHT(#a,4),101)
outputs this
--2013-12-05 00:00:00.000

How to be a command in SQL using LIKE? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to select records where a field (varchar (45)) contains one and only one letter x and the field length is greater than 20
In MySQL you can do:
SELECT * FROM tablename WHERE fieldname REGEXP '^[x]{20,}$'

How to convert money to decimal in SQL Server stored procedure [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have stored procedure where want convert money type to decimal type.
#money = 513.9010 type money
I want to convert it to decimal - how to do that?
select convert(decimal(7,4),#money)